home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / REGKEY30.ZIP / REGKEY.TXT < prev    next >
Text File  |  1994-03-07  |  201KB  |  4,427 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                                                                    R E G K E Y
  14.  
  15.  -----------------------------------------------------------------------------
  16.  
  17.  
  18.                                                                   Version 3.00
  19.  
  20.  
  21.                                        Registration Key System For Programmers
  22.  
  23.  
  24.                                                            Programmer's Manual
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  NOTE:     Since you will probably want to refer to this manual while  working
  48.            with RegKey, it would be a good idea to take a few minutes to print
  49.            it.  To  print  this  manual  on  any  printer,  simply  type  COPY
  50.            REGKEY.TXT PRN from the DOS Prompt, or choose the FILE|PRINT option
  51.            from the Windows File Manager, selecting the REGKEY.TXT file.
  52.  
  53.  
  54.  
  55.  
  56.  
  57.           (C) Copyright Brian Pirie, 1993 - 1994. All Rights Reserved.
  58.  
  59.  
  60.  -----------------------------------------------------------------------------
  61.  TABLE OF CONTENTS
  62.  -----------------------------------------------------------------------------
  63.  
  64.  
  65.            TABLE OF CONTENTS.................................................2
  66.  
  67.            PART 1: INTRODUCTION..............................................3
  68.  
  69.            PART 2: ABOUT YOUR EVALUATION COPY AND REGISTERING................5
  70.                 THE DEMO VERSION & BENEFITS OF REGISTERING...................5
  71.                 HOW TO ORDER.................................................7
  72.                 FILLING OUT THE REGISTRATION FORM............................8
  73.                 RECEIVING YOUR ORDER BY CONVENTIONAL MAIL....................8
  74.                 RECEIVING YOUR ORDER BY A CALL TO YOUR BBS...................9
  75.                 RECEIVING YOUR ORDER BY CALLING THE REGKEY BBS...............9
  76.                 RECEIVING YOUR ORDER BY INTERNET EMAIL.......................9
  77.                 RECEIVING YOUR ORDER BY FIDONET CRASHMAIL....................9
  78.                 SENDING YOUR ORDER FEE......................................11
  79.                 ORDERING THE SOURCE CODE....................................13
  80.                 REGKEY 3.00 ORDER FORM......................................15
  81.                 REGKEY 3.00 USER FEEDBACK FORM..............................16
  82.                 TERMS OF REGISTRATION AND SOURCE CODE USE...................17
  83.  
  84.            PART 3: USING THE REGKEY SYSTEM..................................18
  85.                 A QUICK TOUR OF REGKEY......................................18
  86.                 INTRODUCTION TO REGISTRATION KEYS...........................21
  87.                 PRINCIPLES OF THE REGKEY SYSTEM.............................23
  88.                 FILE-BASED VS. USER-ENTERED REGISTRATION KEYS...............25
  89.                 USING THE KEYGEN PROGRAM....................................27
  90.                 CREATING GENERATION/VALIDATION CODE SETS....................29
  91.                 GENERATING REGISTRATION KEYS................................31
  92.                 VALIDATING REGISTRATION KEYS WITHIN YOUR PROGRAM............34
  93.                 METHODS FOR ADDING EXPIRY INFORMATION.......................37
  94.                 SECURITY ISSUES.............................................40
  95.                 TROUBLESHOOTING GUIDE.......................................43
  96.  
  97.            PART 4: LANGUAGE-SPECIFIC INFORMATION............................46
  98.                 USING THE REGKEY SYSTEM WITH C OR C++.......................46
  99.                 USING THE REGKEY SYSTEM WITH QUICKBASIC.....................54
  100.                 USING THE REGKEY SYSTEM WITH VISUAL BASIC...................60
  101.                 USING THE REGKEY SYSTEM WITH TURBO PASCAL...................61
  102.                 USING REGKEY WITH OTHER LANGUAGES OR OPERATING SYSTEMS......68
  103.  
  104.            PART 5: ADDITIONAL INFORMATION...................................69
  105.                 GETTING HELP................................................69
  106.                 CONTENTS OF PACKAGE.........................................71
  107.                 GLOSSARY....................................................73
  108.                 INDEX.......................................................78
  109.  
  110.  
  111.  
  112.  -----------------------------------------------------------------------------
  113.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 2
  114.  
  115.  
  116.  -----------------------------------------------------------------------------
  117.  PART 1: INTRODUCTION
  118.  -----------------------------------------------------------------------------
  119.  
  120.            Welcome to  RegKey, the  registration key  system for  programmers!
  121.            RegKey is designed to allow you to quickly and easily add  advanced
  122.            registration  key  capabilities  to  your  software.  If  you   are
  123.            unfamiliar with the concept  of registration keys,  see page 20  of
  124.            this manual for an introduction to the subject.
  125.  
  126.            Among the unique features provided by RegKey are the following:
  127.  
  128.           -  RegKey  is  compatible  with  a  wide   variety  of  programming
  129.              languages and operating  systems. This manual  provides specific
  130.              instructions for using  RegKey with  C compilers  from Microsoft
  131.              and Borland (for both  DOS and Windows  applications), Microsoft
  132.              QuickBASIC, Microsoft  Visual  Basic  for Windows , and  Borland
  133.              Turbo Pascal. In addition,  you can  also use  RegKey with  many
  134.              other programming  languages, compilers  and operating  systems.
  135.              For  more  information  on  using  RegKey  in  environments  not
  136.              explicitly discussed in this manual, see page 68.
  137.  
  138.           -  RegKey is  designed to  be very  flexible. For  instance, RegKey
  139.              supports both file-based and user-entered  registration keys. In
  140.              the first case, the registration  key takes the form  of a small
  141.              file that is placed in your  application's working directory. In
  142.              the second case, the registration key takes the form of a twenty
  143.              digit code  that  the  user  enters  into  your  application  or
  144.              configuration program.
  145.  
  146.              RegKey also gives  you full control  of any differences  in your
  147.              application's  behavior  between  registered   and  unregistered
  148.              modes. For  example,  you may  elect  to  have your  application
  149.              display a  short  "please  register"  message  at  startup  when
  150.              operating in unregistered mode. Alternatively, you may decide to
  151.              make additional feature of your program available after the user
  152.              has registered. You might also decide  prevent your program from
  153.              being  used  after  a   certain  period  of  time   if  a  valid
  154.              registration key has not been provided.
  155.  
  156.           -  Every application  that  uses  RegKey  chooses  its own  set  of
  157.              numerical codes  that  RegKey  uses  to  generate  and  validate
  158.              registration keys. This  means that  you can  use RegKey  for as
  159.              many different  applications as  you  wish, requiring  different
  160.              registration keys for each program.
  161.  
  162.           -  RegKey is  designed  so  that  it  is virtually  impossible  for
  163.              someone to  generate  counterfeit  registration  keys  for  your
  164.              software.  The   numerical  code   required  to   generate  your
  165.              registration keys is different from the  corresponding code used
  166.              to validate your  registration keys.  Since only  the validation
  167.  
  168.  -----------------------------------------------------------------------------
  169.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 3
  170.  
  171.  
  172.              code is included in  your program's executable file,  the secret
  173.              numerical code used to generate your registration keys cannot be
  174.              discovered  by   reverse-engineering   your   program.   It   is
  175.              mathematically  infeasible   for  someone   to  determine   your
  176.              generation code from the corresponding validation code.
  177.  
  178.           -  For  added  security,  RegKey  uses  96-bit  registration  keys.
  179.              Because most  compilers and  programming languages  only support
  180.              32-bit arithmetic, registration keys  are most often  no greater
  181.              than 32-bits in size.  While creating a registration  key system
  182.              that supports 96-bit registration  keys involves much  more work
  183.              (creating  RegKey  has  involved  writing  routines  to  perform
  184.              operations as  basic  as adding,  multiplying  and dividing  two
  185.              numbers), it  makes  it  virtually  impossible  to  determine  a
  186.              registration key by an exhaustive search.
  187.  
  188.           -  The source code for  RegKey is also available.  This presents no
  189.              security threat to those using  RegKey due to the  nature of the
  190.              algorithms used  by RegKey.  Even knowing  how  RegKey works  in
  191.              great detail does not make it any easier to generate counterfeit
  192.              registration keys for an application using RegKey.
  193.  
  194.           -  Included with RegKey is an example program that demonstrates how
  195.              you can make use of the RegKey system. This manual also provides
  196.              a tutorial on how you can best use RegKey, and discusses some of
  197.              the issues you may want to consider.
  198.  
  199.           -  RegKey is very  low-priced. For only  $30 Canadian  Dollars, $24
  200.              U.S. Dollars, or your country's equivalent,  you are entitled to
  201.              unlimited use of this and all future versions  of RegKey. For an
  202.              additional $30CDN/$24US/equivalent,  you  may  also receive  the
  203.              RegKey source code.
  204.  
  205.              If you  are using  RegKey to  encourage people  to pay  for your
  206.              software, RegKey will quickly pay for itself!
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  -----------------------------------------------------------------------------
  225.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 4
  226.  
  227.  
  228.  -----------------------------------------------------------------------------
  229.  PART 2: ABOUT YOUR EVALUATION COPY AND REGISTERING
  230.  -----------------------------------------------------------------------------
  231.  
  232.  
  233.  
  234.  THE DEMO VERSION & BENEFITS OF REGISTERING
  235.  -----------------------------------------------------------------------------
  236.  
  237.            RegKey is distributed on a try-before-you-buy basis. If you wish to
  238.            continue using RegKey after an initial one month evaluation period,
  239.            or if you wish to distribute programs using RegKey, you must pay to
  240.            register it.
  241.  
  242.            The complete  RegKey  package is  freely  distributed, and  can  be
  243.            freely  used  for  evaluation   purposes.  All  the  features   and
  244.            capabilities of RegKey are enabled in  the RegKey package that  you
  245.            have. However, prior to registering, you may only use RegKey  under
  246.            the following conditions:
  247.  
  248.           1.) RegKey may only be used for a period up to one month,  and  only
  249.               for evaluation purposes prior to registering.
  250.  
  251.           2.) Programs using  an  unregistered  copy  of  RegKey  may  not  be
  252.               distributed.
  253.  
  254.            Also, when unregistered, RegKey will display a message to the  user
  255.            indicating that  RegKey  is not  registered.  This message  is,  of
  256.            course, removed when RegKey is registered.
  257.  
  258.            If you decided to purchase RegKey,  you will become the owner of  a
  259.            powerful tool  for adding  registration  key capabilities  to  your
  260.            software. Registered owners of RegKey are entitled to:
  261.  
  262.           1.) Unlimited use of RegKey.  You may write as many programs  as you
  263.               wish using RegKey, and do  what you please with  these programs.
  264.               There are no additional royalty fees for using RegKey.
  265.  
  266.           2.) You will also continue to be  registered for all future versions
  267.               of RegKey.
  268.  
  269.            The best news of all  is the low price  of RegKey. This version  of
  270.            RegKey costs only $30  Canadian Dollars, $24  U.S. Dollars, or  the
  271.            equivalent in your country's currency.  As was pointed out  before,
  272.            if you  are  using RegKey  to  encourage  people to  pay  for  your
  273.            software, RegKey  will quickly  pay for  itself! (This  price  will
  274.            probably go up for  future versions. By  registering now, you  will
  275.            save by being able to use all future versions free of charge.)
  276.  
  277.            Many people also elect to receive  the RegKey source code  package.
  278.            The source code for  RegKey is available  to registered owners  for
  279.  
  280.  -----------------------------------------------------------------------------
  281.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 5
  282.  
  283.  
  284.            only an additional $30 Canadian /  $24 U.S. / equivalent. With  the
  285.            RegKey source code, you will be  able to customize it for your  own
  286.            purposes,  port  it  to  other  operating  systems  or  programming
  287.            languages, learn about how RegKey  works, or increase the  security
  288.            of RegKey  by adding  your own  anti-hacking mechanisms.  For  more
  289.            information on ordering the RegKey source code, see page 13.
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  -----------------------------------------------------------------------------
  337.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 6
  338.  
  339.  
  340.  HOW TO ORDER
  341.  -----------------------------------------------------------------------------
  342.  
  343.            To order  your  RegKey  registration and/or  source  code  package,
  344.            simply fill out the order form  located on  page 15 of this manual,
  345.            and mail it along  with your cheque or  money order to the  address
  346.            listed on  the order  form. The  following section  is intended  to
  347.            answer any questions that  you may have  about ordering RegKey.  If
  348.            you have  any  additional  questions or  uncertainties  about  your
  349.            registration, please  feel  more  than  free  to  contact  me.  For
  350.            information on  how to  contact  me,  please  see  page 69 of  this
  351.            manual.
  352.  
  353.            For more information on filling out the order form, see page 8.
  354.  
  355.            For more information on sending your order fee, see page 11.
  356.  
  357.            For more information on ordering the source code, see page 13.
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  -----------------------------------------------------------------------------
  393.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 7
  394.  
  395.  
  396.  FILLING OUT THE REGISTRATION FORM
  397.  -----------------------------------------------------------------------------
  398.  
  399.            If you have printed  the RegKey manual, you  can simply remove  and
  400.            mail the forms on pages 15 and 16.  If you have not already printed
  401.            a copy of the manual, and you have a printer, you can quickly print
  402.            these forms by printing the ORDER.FRM  file included in the  RegKey
  403.            distribution archive. To do this, type COPY ORDER.FRM PRN from your
  404.            DOS prompt. If you are working  with Microsoft Windows, select  the
  405.            ORDER.FRM file and  choose the File|Print  command from within  the
  406.            Windows File Manager.
  407.  
  408.            If you do not have a printer, simply send a handwritten version  of
  409.            the order form.
  410.  
  411.            If you have any special instructions  for me, or anything that  you
  412.            would like to say when you register, feel free to write this on the
  413.            back of the registration form, or on a separate sheet of paper.
  414.  
  415.            When filling out the RegKey registration form, be sure to  indicate
  416.            how you would prefer to receive your RegKey registration key and/or
  417.            source code. The following options are available:
  418.  
  419.           -  Having  me  send   the   registration   and/or  source   code  by
  420.              conventional mail
  421.           -  Internet E-Mail
  422.           -  FidoNet "CrashMail"
  423.           -  Having me call to your BBS
  424.           -  You calling the RegKey support BBS
  425.  
  426.            Once you have decided which means you would prefer to receive  your
  427.            order by,  please  read the  detailed  instructions on  your  order
  428.            method, below. Also, if you are ordering the source code, please be
  429.            sure to read the section on ordering the source code, which  begins
  430.            on page 13.
  431.  
  432.  
  433.  
  434.  -----------------------------------------------------------------------------
  435.  RECEIVING YOUR ORDER BY CONVENTIONAL MAIL
  436.  
  437.            To receive  your  RegKey registration  key  and/or source  code  by
  438.            conventional mail, simply fill out the order form and mail it along
  439.            with your payment as described below.
  440.  
  441.            If you are ordering the source code, it will be sent to you on a 3-
  442.            1/2 inch disk unless  you specifically request  a 5-1/4 inch  disk.
  443.            Because of their  smaller size and  greater durability, 3-1/2  inch
  444.            disks are the preferred format for mailing.
  445.  
  446.  
  447.  
  448.  -----------------------------------------------------------------------------
  449.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 8
  450.  
  451.  
  452.  
  453.  -----------------------------------------------------------------------------
  454.  RECEIVING YOUR ORDER BY A CALL TO YOUR BBS
  455.  
  456.            Since many programmers  operate bulletin board  systems to  provide
  457.            support for their software,  you may elect  to receive your  RegKey
  458.            registration and/or source code by a message and/or upload on  your
  459.            BBS. In order to do this, fill out the order form and mail it along
  460.            with your payment as described below. Be sure to include the  phone
  461.            number, baud rate, and my login  and password for the BBS to  which
  462.            you would like me to call. I will cover any long distance costs. If
  463.            for some reason I  am unable to  connect to your  BBS, I will  send
  464.            your order by conventional mail instead.
  465.  
  466.  
  467.  
  468.  -----------------------------------------------------------------------------
  469.  RECEIVING YOUR ORDER BY CALLING THE REGKEY BBS
  470.  
  471.            You may choose  to receive your  RegKey registration and/or  source
  472.            code by calling the RegKey BBS after your registration form     and
  473.            order fee have  been received here.  If you are  unable to  receive
  474.            your order by  any other electronic  means (such as  a call BBS  to
  475.            your BBS, or by electronic mail), this may be the quickest way  for
  476.            you to receive  your registration information  and/or source  code.
  477.            The obvious disadvantage with this option is that you will have  to
  478.            estimate when your order will arrive here in order to receive it as
  479.            quickly as possible.  You may end  up calling the  RegKey BBS  more
  480.            than once before your order has arrived. After your order form  has
  481.            arrived, your registration key and/or source code will be placed on
  482.            hold for you, and you will be able to receive it on your first call
  483.            to the BBS. The phone number of the BBS is:
  484.  
  485.                           +1 613 526 4466
  486.  
  487.  
  488.  
  489.  -----------------------------------------------------------------------------
  490.  RECEIVING YOUR ORDER BY INTERNET EMAIL
  491.  
  492.            If you wish to receive your RegKey registration key by Internet  E-
  493.            Mail (including Internet E-Mail to a CompuServe account), fill  out
  494.            the order form  and mail it  along with your  payment as  described
  495.            below. Be sure to include your  e-mail address on your order  form.
  496.            Note that the source code cannot be sent by Internet e-mail.
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  -----------------------------------------------------------------------------
  505.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 9
  506.  
  507.  
  508.  -----------------------------------------------------------------------------
  509.  RECEIVING YOUR ORDER BY FIDONET CRASHMAIL
  510.  
  511.            To receive  your  RegKey registration  key  and/or source  code  by
  512.            FidoNet CrashMail, simply fill out the order form and mail it along
  513.            with your  payment  as described  below.  Be sure  to  include  the
  514.            FidoNet node address to  which you wish  to have your  registration
  515.            key and/or source code sent to  (by CrashMail). Again I will  cover
  516.            any long  distance costs.  If,  for some  reason,  I am  unable  to
  517.            connect  to  your  FidoNet  system,  I  will  send  your  order  by
  518.            conventional mail instead.
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  -----------------------------------------------------------------------------
  561.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 10
  562.  
  563.  
  564.  SENDING YOUR ORDER FEE
  565.  -----------------------------------------------------------------------------
  566.  
  567.            The price of  RegKey is 30  Canadian Dollars, 24  U.S. Dollars,  or
  568.            equivalent  for  the  registration.   The  source  code  costs   an
  569.            additional 30 Canadian Dollars, 24 U.S. Dollars, or equivalent. For
  570.            your convenience,  the  equivalent  value  in  a  number  of  other
  571.            country's currencies (at the time of this writing) is listed below:
  572.  
  573.                    -----------------------------------------------
  574.                                             REGISTRATION
  575.                    REGISTRATION ONLY        AND SOURCE CODE
  576.                    -----------------------------------------------
  577.                    30 Canadian Dollars      40 Canadian Dollars
  578.                    24 US Dollars            48 US Dollars
  579.                    15 British Pounds        30 British Pounds
  580.                    130 French Francs        260 French Francs
  581.                    38 German Marks          76 German Marks
  582.                    43 Netherlands Gilders   86 Netherlands Gilders
  583.                    34 Australian Dollars    68 Australian Dollars
  584.                    -----------------------------------------------
  585.  
  586.            This order fee may be paid using any of the following methods:
  587.  
  588.           -  Cheque or  Money  Order  in  Canadian  currency,  drawn  upon  a
  589.              Canadian bank.  In this  case,  your order  fee  will be  either
  590.              $30CDN for  just  the  registration,  or  $60CDN  for  both  the
  591.              registration and source code.
  592.  
  593.           -  Cheque or Money Order in U.S. currency, drawn  upon a U.S. bank.
  594.              In this case, your order fee  will be either $24US  for just the
  595.              registration, or  $48US  for both  the  registration and  source
  596.              code.
  597.  
  598.           -  An  International  Money  Order  or   International  Bank  Draft
  599.              (available from your bank,  post office or organization  such as
  600.              American  Express),  in  Canadian  currency.  Depending  on  the
  601.              particular case, your order fee MAY be sent to  me by the postal
  602.              service, and you will mail your order form by itself. You should
  603.              have the  money  order  drawn  in  either $30CDN  for  just  the
  604.              registration, or  $60CDN for  both the  registration and  source
  605.              code.
  606.  
  607.           -  A cheque  drawn on  any bank  in  the world,  IN THAT  COUNTRY'S
  608.              CURRENCY, equivalent  to  $30  Canadian  dollars  for  just  the
  609.              registration or $60 for  both the registration and  source code.
  610.              For instance,  a cheque  for the  appropriate number  of British
  611.              Pounds, drawn  on  a  British  bank,  is  perfectly  acceptable.
  612.              However, I  am  unable  to  accept  a cheque  for  $30  Canadian
  613.              dollars, drawn on a British Bank.
  614.  
  615.  
  616.  -----------------------------------------------------------------------------
  617.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 11
  618.  
  619.  
  620.           -  Cash.  Cash   orders  are   also  accepted,   but  it   is  your
  621.              responsibility to get that  cash to me safely.  Please note that
  622.              it is not usually recommended that cash be sent in the mail, and
  623.              that I cannot be responsible for any cash lost in the mail.
  624.  
  625.              I would like  to mention that  many people have  already ordered
  626.              RegKey by sending cash, and I have yet to run across any case of
  627.              cash being lost in  the mail. Nonetheless,  if you wish  to send
  628.              cash, you may wish to consider doing so  by registered mail, for
  629.              your added security.
  630.  
  631.  
  632.            If you are ordering RegKey from within Canada, you will most likely
  633.            choose the first option (a Canadian cheque or money order). If  you
  634.            are ordering RegKey from  within the United  States, you will  most
  635.            likely choose  the  second  option (an  American  cheque  or  money
  636.            order). If you are  ordering from outside Canada  and the U.S.,  it
  637.            would be ideal if you could send your fee by an international money
  638.            order. However, any of the above  order methods will be  acceptable
  639.            from any location. Also, it is quite possible that I may be able to
  640.            accept other means  of sending your  order fee. If  you are  unsure
  641.            about sending your order fee, please feel free to get in touch with
  642.            me by any of the means listed on page 69.
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  -----------------------------------------------------------------------------
  673.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 12
  674.  
  675.  
  676.  ORDERING THE SOURCE CODE
  677.  -----------------------------------------------------------------------------
  678.  
  679.            Many people who  register RegKey also  choose to  order the  source
  680.            code package. With  the RegKey  source code,  you will  be able  to
  681.            customize it  for your  own purposes,  port it  to other  operating
  682.            systems or programming languages, learn about how RegKey works,  or
  683.            increase the security of RegKey  by adding  your own "anti-hacking"
  684.            mechanisms.
  685.  
  686.            As mentioned before, the RegKey source  code may be ordered for  an
  687.            additional  $30  Canadian  Dollars,   $24  U.S.  Dollars,  or   the
  688.            equivalent in  your  country's currency.  The  source code  may  be
  689.            ordered either at the same time you register RegKey, or separately.
  690.            If you  wish to  order the  RegKey source  code, simply  check  the
  691.            appropriate box on the order form,  and include the additional  fee
  692.            for ordering  the source  code. When  you order  the RegKey  source
  693.            code, you will receive it either on a diskette, or  electronically,
  694.            depending upon  how you  chose to  receive  your order.  (For  more
  695.            information on these options, see the  section that begins on  page
  696.            8.)
  697.  
  698.            Also, as with your RegKey registration,  when you order the  RegKey
  699.            source code, you are entitled to receive all future versions of the
  700.            source code. Whenever you wish to receive an updated version of the
  701.            source code package,  you can either  download it  from the  RegKey
  702.            support BBS, or send $3 dollars to cover the cost of postage and  a
  703.            diskette to my address.
  704.  
  705.            The RegKey source code package includes  both the core source  code
  706.            of RegKey  itself, and  the source  code for  the DOS  and  Windows
  707.            version of the KeyGen program.  RegKey itself  is written in  ANSI-
  708.            compliant C, and is designed to be easily ported to other platforms
  709.            or operating systems. In addition to the C source code for  RegKey,
  710.            you will receive optimized 80x86 assembly language source code  for
  711.            some of the RegKey routines. Since the equivalent C source code  is
  712.            included for all  assembly language routines,  use of the  assembly
  713.            language source code  is optional. However,  the assembly  language
  714.            routines provide  dramatically  improved  performance.  The  RegKey
  715.            source code has been compiled with C compilers from both  Microsoft
  716.            and Borland. The  source code package  also includes  a basic  test
  717.            program that  exercises various  components  of the  RegKey  source
  718.            code, and can help you in locating problems when porting RegKey to
  719.            other platforms.
  720.  
  721.            The KeyGen source code is  divided into  three components  - a core
  722.            module common to both DOS and Windows version, a module  containing
  723.            the DOS-specific  interface  code,  and  a  module  containing  the
  724.            Windows-specific interface  code. The  source code  for the  common
  725.            module is  again  written  in ANSI-compliant  C.  The  DOS-specific
  726.            interface code is  also written in  ANSI-compliant C, but  contains
  727.  
  728.  -----------------------------------------------------------------------------
  729.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 13
  730.  
  731.  
  732.            many MS-DOS specific elements. The Windows-specific interface  code
  733.            is written  in C++,  and uses  the "Microsoft  Foundation  Classes"
  734.            interface to the Windows operating system. The Microsoft Foundation
  735.            Classes  library  is  included  with  recent  C++  compilers   from
  736.            Microsoft and others.
  737.  
  738.            For information on  what you are  permitted to do  with the  RegKey
  739.            source code, see the terms and conditions on page 17.
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  -----------------------------------------------------------------------------
  785.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 14
  786.  
  787.  
  788.  -----------------------------------------------------------------------------
  789.                             REGKEY 3.00 ORDER FORM
  790.  -----------------------------------------------------------------------------
  791.  
  792.           YOUR NAME : _______________________________   (AS SHOULD APPEAR IN
  793.                                                          REGISTRATION)
  794.      POSTAL ADDRESS : ______________________________________________________
  795.  
  796.                       ______________________________________________________
  797.  
  798.  VOICE PHONE NUMBER : ______________________
  799.  
  800.     EMAIL ADDRESSES : ____________________________________   (IF APPLICABLE)
  801.  
  802.  
  803.  I WISH TO RECEIVE MY ORDER BY:
  804.            ___                                ___
  805.           |   | - CONVENTIONAL MAIL          |   | - FIDONET "CRASHMAIL"
  806.           |___|                              |___|
  807.            ___                                ___
  808.           |   | - CALL TO MY BBS             |   | - INTERNET E-MAIL
  809.           |___|   (INCLUDE NECESSARY INFO)   |___|   (REGISTRATION KEY ONLY)
  810.            ___
  811.           |   | - CALL TO REGKEY BBS
  812.           |___|
  813.  
  814.                          ___
  815.  I WOULD LIKE TO ORDER: |   | - JUST MY REGISTRATION KEY
  816.                         |___|   ($30 CDN, $24US, OR EQUIVALENT)
  817.                          ___
  818.                         |   | - JUST THE SOURCE CODE (ONLY IF ALREADY
  819.                         |___|   REGISTERED) ($30 CDN, $24 US, OR EQUIVALENT)
  820.                          ___
  821.                         |   | - BOTH REGISTRATION KEY AND SOURCE CODE
  822.                         |___|   ($60 CDN, $48 US, OR EQUIVALENT)
  823.  
  824.  
  825.  I AGREE TO THE REGKEY TERMS, SET              ____________________________
  826.  FORTH ON PAGE 17 OF THE MANUAL                (SIGNATURE)
  827.  
  828.  MAKE CHEQUES PAYABLE TO:   BRIAN PIRIE
  829.                             APT. 1416 - 2201 RIVERSIDE DR.
  830.                             OTTAWA, ONTARIO
  831.                             CANADA
  832.                             K1H 8K9
  833.  
  834.  +-- OFFICIAL USE ONLY ------------------------------------------------------+
  835.  |                                                                           |
  836.  | Rcvd : _______  Date : _________  S.N. : _________  Key : _______________ |
  837.  +---------------------------------------------------------------------------+
  838.  
  839.  
  840.  -----------------------------------------------------------------------------
  841.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 15
  842.  
  843.  
  844.  -----------------------------------------------------------------------------
  845.                         REGKEY 3.00 USER FEEDBACK FORM
  846.  -----------------------------------------------------------------------------
  847.  
  848.           YOUR NAME : _______________________________
  849.  
  850.      POSTAL ADDRESS : ______________________________________________________
  851.  
  852.                       ______________________________________________________
  853.  
  854.  VOICE PHONE NUMBER : ______________________
  855.  
  856.     EMAIL ADDRESSES : ____________________________________   (IF APPLICABLE)
  857.  
  858.  
  859.  HOW DID YOU FIRST LEARN OF REGKEY?
  860.  
  861.               ____________________________________________________________
  862.  
  863.  
  864.  WHICH LANGUAGE / COMPILER AND VERSION ARE YOU USING?  (EG. BORLAND C++ 3.10)
  865.  
  866.               ____________________________________________________________
  867.  
  868.  
  869.  WHAT DO YOU LIKE MOST ABOUT REGKEY?
  870.  
  871.               ____________________________________________________________
  872.  
  873.               ____________________________________________________________
  874.  
  875.               ____________________________________________________________
  876.  
  877.  
  878.  WHAT CHANGES OR ADDITIONS WOULD YOU LIKE TO SEE IN FUTURE VERSIONS?
  879.  
  880.               ____________________________________________________________
  881.  
  882.               ____________________________________________________________
  883.  
  884.               ____________________________________________________________
  885.  
  886.  
  887.  DO YOU HAVE ANY ADDITIONAL COMMENTS?
  888.  
  889.               ____________________________________________________________
  890.  
  891.               ____________________________________________________________
  892.  
  893.  
  894.  -----------------------------------------------------------------------------
  895.  
  896.  -----------------------------------------------------------------------------
  897.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 16
  898.  
  899.  
  900.  TERMS OF REGISTRATION AND SOURCE CODE USE
  901.  -----------------------------------------------------------------------------
  902.  
  903.            When you purchase a RegKey registration and/or source code package,
  904.            you are entitled to almost unlimited use of all versions of RegKey.
  905.            However, in order to  protect my investment of  time and effort  in
  906.            developing RegKey, you must also agree to the terms outlined  below
  907.            when purchasing a RegKey registration and/or the source code. These
  908.            terms are very reasonable,  and are in no  way intended to  cripple
  909.            your use of RegKey. The primary  intent of these terms is that  you
  910.            are not permitted to disclose your RegKey registration information,
  911.            or the  RegKey source  code, to  other  individuals. The  terms  of
  912.            registration and source code use are as follows:
  913.  
  914.            For the  purpose of  these terms,  "RegKey" is  defined to  be  the
  915.            library files,  header  files, example  programs  and  programmer's
  916.            manual of all versions, present and  future, for all languages  and
  917.            platforms, of the RegKey registration key system. Upon  registering
  918.            RegKey, the individual  or organization named  on the  registration
  919.            form (the registree) is entitled to use of all versions of  RegKey,
  920.            within the terms set forth below. Violation of these terms will  be
  921.            considered copyright infringement, and grounds for the  termination
  922.            of the registration  agreement. The  registree is  entitled, at  no
  923.            additional cost, to use, distribute  or sell the executable  (.EXE,
  924.            .COM, .DLL) files that  result from using  the RegKey toolkit.  The
  925.            registree is also entitled to use,  distribute or sell the  example
  926.            programs or portions  thereof. If purchasing  the source code,  the
  927.            registree is also entitled to distribute any executable files  that
  928.            result from using altered versions of the source code, or  portions
  929.            thereof.  The  registree   is  NOT  entitled   to  distribute   the
  930.            registration key number presented  to them at registration,  except
  931.            when imbedded  in the  executable files  of  a program  which  uses
  932.            RegKey. The registree is not permitted to distribute any portion of
  933.            the RegKey  source  code.  For the  purposes  of  these  terms,  an
  934.            organization  is  considered   to  be  a   company  or   non-profit
  935.            organization. If the registree is an organization, the registration
  936.            key  and  source  code   may  be  shared   among  members  of   the
  937.            organization, under the condition that these individuals are  using
  938.            the registration and/or source code only for official activities of
  939.            that organization.
  940.  
  941.            These terms in  no way suggest  an agreement on  the part of  Brian
  942.            Pirie to develop any future versions of RegKey, or fix any problems
  943.            in current versions of  RegKey. RegKey is offered  "as is", and  no
  944.            warrantees are expressed or implied. In no event shall Brian  Pirie
  945.            be liable for any loss of profit or any other damage, including but
  946.            not limited to special, incidental, consequential or other damages.
  947.            This means  that it  is solely  the registree's  responsibility  to
  948.            determine  the   suitability   of  RegKey   for   the   registree's
  949.            application(s).  This  also  means  that  no  guarantees  are  made
  950.            concerning the portability or compatibility of the RegKey system.
  951.  
  952.  -----------------------------------------------------------------------------
  953.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 17
  954.  
  955.  
  956.  -----------------------------------------------------------------------------
  957.  PART 3: USING THE REGKEY SYSTEM
  958.  -----------------------------------------------------------------------------
  959.  
  960.  
  961.  
  962.            This portion of the manual  contains information about RegKey  that
  963.            is common to  all languages  supported by  RegKey. Part  4 of  this
  964.            manual, which begins on page  46, provides information specific  to
  965.            each programming language supported by RegKey.
  966.  
  967.            The following sections describe the basic principles of the  RegKey
  968.            system, provide  step-by-step  information on  how  to  incorporate
  969.            RegKey into your applications, and discuss some of the issues  that
  970.            you will want to  consider when using  RegKey. This information  is
  971.            divided into the following sections:
  972.  
  973.                 A Quick Tour of RegKey......................................18
  974.                 Introduction to Registration Keys...........................20
  975.                 Principles of the RegKey System.............................23
  976.                 File-Based vs. User-Entered Registration Keys...............25
  977.                 Using the KeyGen program....................................27
  978.                 Creating Generation/Validation Code Sets....................29
  979.                 Generating Registration Keys................................31
  980.                 Validating Registration Keys................................34
  981.                 Methods for Adding Expiry Information.......................37
  982.                 Security Issues.............................................40
  983.  
  984.  
  985.  
  986.  A QUICK TOUR OF REGKEY
  987.  -----------------------------------------------------------------------------
  988.  
  989.            This section provides a quick overview  of the RegKey package,  and
  990.            is intended  for those  who want  to see  RegKey in  action  before
  991.            reading the detailed  information in the  following sections.  This
  992.            section does not attempt to explain  the use of the RegKey  package
  993.            in detail, but simply guides you on a tour of some of the  programs
  994.            and files included in the RegKey package. If at any point you  want
  995.            to learn more about RegKey, or  are having trouble understanding  a
  996.            particular concept, you can skip to the following sections of  this
  997.            manual for a more detailed tutorial. You may also find the glossary
  998.            on page 73 and the troubleshooting guide on page 43 useful.
  999.  
  1000.            Since RegKey supports a  number of different programming  languages
  1001.            (C, C++,  Pascal and  BASIC), in  both  the MS-DOS  and  MS-Windows
  1002.            environments, not all the files included in the RegKey package will
  1003.            be of use  to you.  Depending upon how  you received  your copy  of
  1004.            RegKey, some of  the RegKey files  may be stored  in archive  files
  1005.            with the following names. If this  is the case, you should  extract
  1006.  
  1007.  
  1008.  -----------------------------------------------------------------------------
  1009.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 18
  1010.  
  1011.  
  1012.            the contents of the file below that are relevant to the programming
  1013.            language you will be using.
  1014.  
  1015.            C_CPP.ZIP           Contains C/C++ language specific files
  1016.            QB.ZIP              Contains QuickBASIC specific files
  1017.            VB.ZIP              Contains Visual Basic specific files
  1018.            TP.ZIP              Contains Turbo Pascal specific files
  1019.  
  1020.            (A complete  list and  description of  the  files included  in  the
  1021.            RegKey package is located on page 71.)
  1022.  
  1023.            The  RegKey   package   provides  two   distinct   facilities   for
  1024.            implementing registration keys within your applications. The  first
  1025.            facility is used for generating registration keys, typically when a
  1026.            user purchases your software. This facility is generally used  only
  1027.            by yourself  or those  responsible  for selling  your  application.
  1028.            Registration  keys  can  be  generated  using  the  KeyGen  utility
  1029.            included in the RegKey package, or  you may write a custom  program
  1030.            to manage the generation of registration keys.
  1031.  
  1032.            The second facility  provided by RegKey  is incorporated into  your
  1033.            program itself, and is used to  check the validity of  registration
  1034.            keys at  run  time. Although  the  details of  this  facility  vary
  1035.            depending upon the programming language you are using, they  always
  1036.            involve calling  a  RegKey  function/procedure  that  performs  the
  1037.            actual registration key validation. You are then able to adjust the
  1038.            behavior of  your program  depending upon  the result  returned  by
  1039.            RegKey. This provides you with the  option of displaying a  special
  1040.            message when the user is not registered, disabling certain features
  1041.            when operating in unregistered "demo" mode, or limiting the  length
  1042.            of time someone may use your software before paying for it.
  1043.  
  1044.            Included with RegKey is a very simple demonstration program,  named
  1045.            DemoApp, which  allows you  to test  RegKey and  learn how  to  use
  1046.            RegKey within your own programs.  The RegKey package includes  both
  1047.            MS-DOS and MS-Windows executable versions of DemoApp - DEMOAPPD.EXE
  1048.            and DEMOAPPW.EXE. The RegKey  package also includes the  equivalent
  1049.            source code for DemoApp in the C, C++, Turbo Pascal, QuickBASIC and
  1050.            Visual Basic languages.  To  get a  better  idea of  how  RegKey's
  1051.            registration key validation facility can be incorporated into  your
  1052.            program, have a look at the version of the DemoApp source code  for
  1053.            the language  you are  most familiar  with.  Also, you  should  try
  1054.            running DemoApp  to  see  how it  behaves  before  you  generate  a
  1055.            registration key for it.
  1056.  
  1057.            As mentioned  before, you  can  generate RegKey  registration  keys
  1058.            using the KeyGen utility. To start the DOS version of KeyGen, type
  1059.            the KEYGEND  command  at  the DOS  prompt,  while  located  in  the
  1060.            directory where  you have  placed the  RegKey files.  To start  the
  1061.            Windows version of KeyGen, you can double-click on the  KEYGENW.EXE
  1062.            file from within  the Windows File  Manager. If you  are using  the
  1063.  
  1064.  -----------------------------------------------------------------------------
  1065.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 19
  1066.  
  1067.  
  1068.            Windows version of KeyGen, the  included CTL3DV2.DLL file should be
  1069.            MOVED to your Windows system directory.  (You may also wish to  add
  1070.            KeyGen  to  a  group  within  the  Windows  Program  Manager.   For
  1071.            instructions on how to do this, see page 27.) Once you have started
  1072.            the KeyGen program, you will see  a list of applications for  which
  1073.            you can generate a registration key.  Initially, there should be  a
  1074.            single application listed:  "DemoApp (RegKey  Example Program".  To
  1075.            generate a registration key for DemoApp, simply select it from  the
  1076.            list of  applications,  and choose  the  "Generate Key"  option.  A
  1077.            second  dialog  box  will  appear,  with  which  you  can   provide
  1078.            information on the registration key to generate. Enter your name as
  1079.            the "Registration String", and enter any combination of 10  numbers
  1080.            and upper-case letters as the "Random Seed". "Registration  String"
  1081.            is usually  the name  of the  individual or  organization that  has
  1082.            purchased your software. The "Random Seed" is used by RegKey during
  1083.            the registration key generation process, and is then discarded. You
  1084.            should enter a different random seed  for each key you  generation.
  1085.            To generate a  registration key  for DemoApp,  you do  not need  to
  1086.            change any other options in the key generation dialog box. When you
  1087.            select "OK",  KeyGen  will generate  a  registration key  file  for
  1088.            DemoApp, and will then ask you whether you wish to generate another
  1089.            registration key.
  1090.  
  1091.            RegKey   supports   both    file-based   and    user-entered-string
  1092.            registration  keys.   With   file-based  registration   keys,   the
  1093.            registered user receives a small "key file" which is recognized and
  1094.            read by the application at run-time, in order to determine  whether
  1095.            to operate in registered  mode. With user-entered-string keys,  the
  1096.            user enters their  name and a  20 digit registration  key into  the
  1097.            application, which causes it to operate in registered mode.
  1098.  
  1099.            The DemoApp example  program included with  RegKey uses  file-based
  1100.            registration keys. Now that you  have generated a registration  key
  1101.            file for RegKey, you can try running DemoApp again. Ensure that the
  1102.            newly generated key file,  (named ????????.KEY, unless you  changed
  1103.            the default option in the key generation dialog box), is located in
  1104.            the default  directory before  staring  DemoApp. DemoApp  will  now
  1105.            operate in registered  mode, and will  display the registered  user
  1106.            name you entered when generating the registration key.
  1107.  
  1108.            Congratulations! You  have  successfully  completed  your  tour  of
  1109.            RegKey. The  following  sections  provide you  with  more  detailed
  1110.            information on  using  RegKey,  and  part  4  provides  information
  1111.            specific to using RegKey with each of the supported languages.
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  -----------------------------------------------------------------------------
  1121.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 20
  1122.  
  1123.  
  1124.  INTRODUCTION TO REGISTRATION KEYS
  1125.  -----------------------------------------------------------------------------
  1126.  
  1127.            This section  provides an  introduction  to registration  keys  for
  1128.            those who  are unfamiliar  with the  concept.  If you  are  already
  1129.            familiar with the notion behind registration keys, you may wish  to
  1130.            proceed  to  the  following  section,  "Principles  of  the  RegKey
  1131.            System", on page 23.
  1132.  
  1133.            Registration keys are  a form of  software protection;  they are  a
  1134.            mechanism to  encourage users  to pay  for  your software  or  even
  1135.            prevent them from using it without paying for it. Registration keys
  1136.            are often used as  an only means  of software protection,  although
  1137.            they can  easily  be  combined  with  other  mechanisms  for  added
  1138.            security  and  effectiveness.  Unlike   other  forms  of   software
  1139.            protection, such  as software  copy  protection or  hardware  keys,
  1140.            registration keys are ideal  for shareware  or "try-before-you-buy"
  1141.            software.  Using  registration  keys,  you  have  the  ability   to
  1142.            distribute a single copy of your  software that serves as both  the
  1143.            demonstration version and "full" version.
  1144.  
  1145.            The idea behind registration keys is  simple. When a customer  pays
  1146.            for your software, they receive a registration key - either in  the
  1147.            form of a small additional file or a numeric code - which  switches
  1148.            the  software  into  registered   mode.  The  differences   between
  1149.            registered and unregistered  modes can  be as  insignificant or  as
  1150.            great as  you choose.  The software  may simply  display a  "please
  1151.            register" message when unregistered,  it may only  work for a short
  1152.            evaluation period prior to registering, additional features may  be
  1153.            enabled after registering,  or the software  may refuse to  operate
  1154.            entirely before registration.
  1155.  
  1156.            While the  use  of  registration key  systems  is  not  limited  to
  1157.            shareware applications, this  is where registration  keys are  most
  1158.            often used. Many  of the advantages  of the  shareware approach  to
  1159.            software marketing are obvious  - the user  has the opportunity  to
  1160.            try the software before buying it, the software producer is able to
  1161.            reach a wide  audience of potential  customers, and it  is often  a
  1162.            low-cost approach to software marketing. In general, there are  two
  1163.            approaches to shareware marketing. In the first approach, a special
  1164.            demonstration version  of the  software  is freely  distributed  to
  1165.            users,  and  when  the  user  registers  they  receive  the  "full"
  1166.            registered version  of  the  software. With  the  registration  key
  1167.            approach, only  one  version  of the  software  is  released.  This
  1168.            version  normally  operates  in  "unregistered"  or  "demo"   mode.
  1169.            However, when  the  user pays  for  the software,  they  receive  a
  1170.            registration key which  immediately causes the  software to  switch
  1171.            into "registered" mode. Of  these two approaches, the  registration
  1172.            key approach has become very popular for a number of reasons:
  1173.  
  1174.  
  1175.  
  1176.  -----------------------------------------------------------------------------
  1177.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 21
  1178.  
  1179.  
  1180.           -  It has proven highly effec tive in encouraging people to pay  for
  1181.              the software.
  1182.  
  1183.           -  Since the registration  key is associated  with a  single user's
  1184.              name, it discourages illegal sharing of the registration. People
  1185.              are more  likely to  give away  a copy  of a  generic registered
  1186.              version of the software than they are  to share the registration
  1187.              key that  is associated  with only  their name.  Although it  is
  1188.              possible to  "brand" each  registered copy  of the  software for
  1189.              each user who registers, this often proves to be a great deal of
  1190.              work.
  1191.  
  1192.           -  Registration keys enable the user to  easily switch the software
  1193.              into  registered  mode  upon  registering,   without  having  to
  1194.              reinstall a registered version of the software.
  1195.  
  1196.           -  Registration keys also  allow the option  of upgrading to  a new
  1197.              version by receiving  a widely available  copy of  the software,
  1198.              rather than  having to  receive a  new registered  copy directly
  1199.              from the author.
  1200.  
  1201.           -  If user-entered registration  keys are used  (see page  25 for a
  1202.              comparison  between  user-entered  and  file-based  registration
  1203.              keys), the registration  key can be  quickly transmitted  to the
  1204.              user by  phone, email,  fax or  conventional  mail, rather  than
  1205.              sending a registered version of the entire software package.
  1206.  
  1207.            In addition  to shareware  applications,  registration keys  can be
  1208.            useful  for  many  other  software  protection  applications.   For
  1209.            instance, registration keys can be used in implementing pay-per-use
  1210.            software, where a  new registration key  is sent to  the user  when
  1211.            they pay for additional use of the software. Registration keys  can
  1212.            also be just as useful in discouraging the copying of non-shareware
  1213.            software  as  it  is  for  encouraging  registration  of  shareware
  1214.            software. Registration keys can also  form the basis of  multi-user
  1215.            site licensing systems. Although this manual cannot explicitly deal
  1216.            with all  of the  potential  uses of  the  RegKey system,  it  does
  1217.            attempt  to  provide  general  information  that  will  be  of  use
  1218.            regardless of how you are using RegKey.
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  -----------------------------------------------------------------------------
  1233.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 22
  1234.  
  1235.  
  1236.  PRINCIPLES OF THE REGKEY SYSTEM
  1237.  -----------------------------------------------------------------------------
  1238.  
  1239.            This  section  provides  an   introduction  to  the  concepts   and
  1240.            terminology used by  RegKey. The remainder  of this manual  assumes
  1241.            that you have read this section.
  1242.  
  1243.            A  registration  string  and  corresponding  registration  key  is
  1244.            associated with each person who pays to register your software. The
  1245.            registration  string   uniquely   identifies  the   individual   or
  1246.            organization that has registered, and may contain other information
  1247.            that should not be tampered with.  In many cases, the  registration
  1248.            string will  only be  the  user's name,  but  it may  also  include
  1249.            information such as the registration's  expiry date or the  version
  1250.            of your software that was registered. (For more help on how to  add
  1251.            expiry information  to  registration  keys, see  the  section  that
  1252.            begins on page  37.) In general, the  registration string contains
  1253.            information that the user knows before registering, for which  your
  1254.            application must be able to recognize your "stamp of approval".
  1255.  
  1256.            One  of  the  key  features  of  RegKey  is  the  fact  that  every
  1257.            application using RegKey  requires different  registration keys;  a
  1258.            particular  user's  registration  key  that  is  accepted  by   one
  1259.            application using RegKey will not work with a different application
  1260.            using RegKey. For each application or version for which you wish to
  1261.            require  different   registration   keys,  a  unique   generation /
  1262.            validation code set is created.  Choosing a different  generation /
  1263.            validation code set  results in different  registration keys  being
  1264.            generated and accepted for the same registration string.
  1265.  
  1266.            The secret generation  code is used  to generate registration  keys
  1267.            for your  applications.  The  generation  code  is  only  known  by
  1268.            yourself or people responsible for generating registration keys for
  1269.            your application; the  generation code would  never appear in  your
  1270.            program's  executable  file(s).   Every  generation   code  has   a
  1271.            corresponding validation code.  This validation code is used during
  1272.            your application's  execution in  order  to determine  whether  the
  1273.            supplied registration string (such as the user's name)  corresponds
  1274.            to the supplied registration key. If the registration key is  valid
  1275.            for the registration string  and validation code, RegKey  indicates
  1276.            to your application that it should operate in registered mode.  The
  1277.            validation code  is  contained  within  your  program's  executable
  1278.            files. Although it  may be  possible to  determine this  validation
  1279.            code by  "hacking" your  program's executable  files, there  is  no
  1280.            known feasible way  to calculate the  generation code knowing  this
  1281.            validation code. Therefore,  knowing the validation  code does  not
  1282.            permit someone to generate  counterfeit registration keys for  your
  1283.            software.
  1284.  
  1285.            The registration string and registration key may  either be entered
  1286.            directly into your application by the  user, or may both be  stored
  1287.  
  1288.  -----------------------------------------------------------------------------
  1289.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 23
  1290.  
  1291.  
  1292.            in a registration key  file. The first approach  is referred to  as
  1293.            user-entered registration keys, and the second approach is referred
  1294.            to as file-based registration keys.  The following section of  this
  1295.            manual discusses the advantages and disadvantages of each approach.
  1296.  
  1297.            Subsequent  sections  of  this  manual  discuss  how  to  use   the
  1298.            facilities provided  by RegKey  to create  a  generation/validation
  1299.            code set for a new application,  how to generate a registration key
  1300.            for a user when they pay for  your software, and how to use  RegKey
  1301.            to deal with registration keys within your application itself.
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  -----------------------------------------------------------------------------
  1345.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 24
  1346.  
  1347.  
  1348.  FILE-BASED VS. USER-ENTERED REGISTRATION KEYS
  1349.  -----------------------------------------------------------------------------
  1350.  
  1351.            RegKey provides support for two types of registration keys:  "user-
  1352.            entered" and "file-based". For a given application, you must choose
  1353.            which of these two types you wish to use.
  1354.  
  1355.            With user-entered  registration  keys, upon  registering  the  user
  1356.            receives a 20 digit code of numbers and letters, such as:
  1357.  
  1358.                      F8T5CQ7LFVXDY6TSC4QU
  1359.  
  1360.            To avoid confusion when copying  the registration key, RegKey  does
  1361.            not use the letters G, I,  O, S, as they  may be confused with  the
  1362.            numerals 6, 1,  0 and  5. If the  user accidentally  enters any  of
  1363.            these letters in  place of the  corresponding number, RegKey  knows
  1364.            that the  number  was  intended, as  treats  the  letter  as  being
  1365.            equivalent to  the number.  Likewise, RegKey  only uses  upper-case
  1366.            letters when generating registration keys, but is not sensitive  to
  1367.            case when validating registration keys.
  1368.  
  1369.            When they  pay  for your  software,  the user  would  typically  be
  1370.            required to enter  this 20-digit code  along with  their name  (the
  1371.            registration  string)  into   your   application  or  configuration
  1372.            program, for example:
  1373.  
  1374.                           Your Name : Brian Pirie
  1375.               Your Registration Key : F8T5CQ7LFVXDY6TSC4QU
  1376.  
  1377.            This information would  then be stored  by your program  in a  data
  1378.            file, for access when the  program is subsequently executed.  Using
  1379.            RegKey, your  application could  then determine  whether or  not  a
  1380.            valid registration key for the user's name has been presented,  and
  1381.            act accordingly.
  1382.  
  1383.            When file-based registration keys are used, rather than receiving a
  1384.            20 digit code, the user receives  a file in electronic form,  which
  1385.            they either manually copy  to the application's working  directory,
  1386.            or install using  a simple installation  program that you  provide.
  1387.            When your application executes, it would  then call upon RegKey  to
  1388.            read this file and  determine whether or  not a valid  registration
  1389.            key file is present. If RegKey indicates that this file is  present
  1390.            and valid, your program would know to operate in registered mode.
  1391.  
  1392.            User-entered and file-base registration keys each provide different
  1393.            advantages and disadvantages.  User-entered registration keys  have
  1394.            the advantage that no disk or  electronic file needs to be sent  to
  1395.            the registered user. This allows you  full flexibility to send  the
  1396.            registration key by conventional  mail, electronic mail,  facsimile
  1397.            or over  the  telephone.  The RegKey  registration  key  format  is
  1398.            specifically designed to be  easy to transmit  by this means.  It's
  1399.  
  1400.  -----------------------------------------------------------------------------
  1401.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 25
  1402.  
  1403.  
  1404.            use of  both  letters and  numbers  makes  it a  very  compact  and
  1405.            efficient  representation  for  the   96-bits  of  information   it
  1406.            contains, while its choice of numbers and upper case letters  helps
  1407.            to reduce the possibility of mis-copying the string.
  1408.  
  1409.            File-based registration keys, on the other hand, may be easier  for
  1410.            the user.  Rather than  having to  enter the  registration key  and
  1411.            related information manually, the user  simply needs to install  an
  1412.            additional small  file. File-based  registration keys  may also  be
  1413.            preferable if  the registration  string  contains  more information
  1414.            than simply the user's  name. This might be  the case when you  are
  1415.            imbedding  expiry   information  in  the   registration  string  as
  1416.            described in the section which begins on page 37.
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  -----------------------------------------------------------------------------
  1457.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 26
  1458.  
  1459.  
  1460.  USING THE KEYGEN PROGRAM
  1461.  -----------------------------------------------------------------------------
  1462.  
  1463.            The RegKey  package includes  both DOS  and Windows  versions of  a
  1464.            program called "KeyGen".  KeyGen can  be used  for both creating  a
  1465.            generation/validation  code set  for  a  new  application  and  for
  1466.            quickly generating  registration  keys  for one  or  more  of  your
  1467.            applications.  KeyGen also provides password security facilities to
  1468.            control access to the registration key generation information  that
  1469.            it stores. This section provides some  basic information on how  to
  1470.            setup, maintain  and navigate  through  the KeyGen  program.  Later
  1471.            sections of this  manual provide information  on how to  accomplish
  1472.            specific tasks using  KeyGen, such as  creating a new  code set  or
  1473.            generating a registration key for a new user.
  1474.  
  1475.            To start  the  DOS version  of  KeyGen,  simply  go  to  the RegKey
  1476.            directory and type KEYGEND from the DOS prompt.
  1477.  
  1478.            The Windows version  of KeyGen requires  Microsoft Windows  version
  1479.            3.1 or later. Before using the Windows version of KeyGen, you  must
  1480.            MOVE the  CTL3DV2.DLL file  to your  Windows system  directory.  To
  1481.            start the Windows version of KeyGen, you may simply double-click on
  1482.            the KEYGENW.EXE  file, from  within in  the Windows  File  Manager.
  1483.            KEYGENW.EXE will be located  in the same  directory where you  have
  1484.            placed your other RegKey files.
  1485.  
  1486.            Rather than starting up KeyGen from the Windows file  manager,  you
  1487.            may prefer to  add KeyGen to  one of your  Windows program  manager
  1488.            groups. To do this, select the existing group to which you wish  to
  1489.            add KeyGen,  or create  a new  program  manager group.  Now  choose
  1490.            FILE|NEW|PROGRAM  ITEM.  In  the  "Properties"  dialog  box,  enter
  1491.            "KeyGen" as the description, enter the full path to the KEYGENW.EXE
  1492.            file as the command line, and enter the directory where KEYGENW.EXE
  1493.            is located as the working directory. Now choose "OK" to add  KeyGen
  1494.            to the current program manager group. You will now be able to start
  1495.            KeyGen by  double-clicking  on the  KeyGen  icon. The  KeyGen  icon
  1496.            appears as  a diskette  with a  golden key  in front  of it.  (This
  1497.            information applies to using  KeyGen with MS-Windows versions  3.x.
  1498.            If you are  using MS-Windows version  4.0 or later,  refer to  your
  1499.            Windows manual for information  on executing a Windows  application
  1500.            given the filename).
  1501.  
  1502.            If you are using an operating system other and MS-DOS or MS-Windows
  1503.            which has the ability to execute  DOS or Windows programs (such  as
  1504.            OS/2), see your operating system  manual(s) for information on  how
  1505.            to  do  this.  The  filename  of  the  DOS  version  of  KeyGen  is
  1506.            KEYGEND.EXE, and the filename of the  Windows version of KeyGen  is
  1507.            KEYGENW.EXE.
  1508.  
  1509.            The DOS and Windows  versions of KeyGen  operate very  similarly to
  1510.            one another. Both  can be used  with either keyboard  or mouse  (or
  1511.  
  1512.  -----------------------------------------------------------------------------
  1513.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 27
  1514.  
  1515.  
  1516.            similar pointing  device such  as a  trackball  or pen),  and  both
  1517.            provide an identical layout of Windows and dialog boxes. When using
  1518.            a pointing device to navigate through  KeyGen, simply point to  the
  1519.            item you wish to change or activate, and press the pointing  device
  1520.            button. When using a keyboard to  navigate through KeyGen, use  the
  1521.            [Tab] key to move among items,  and press [Enter] or [Spacebar]  to
  1522.            activate items.
  1523.  
  1524.            The DOS and  Windows version  of KeyGen  also  share the  same data
  1525.            file, KEYGEN.DAT.  If  you  are relying  on  KeyGen  to  store  the
  1526.            generation/validation code sets for your applications, this file is
  1527.            very sensitive.  Be careful  to control  access to  this file.  You
  1528.            should also be absolutely certain that you maintain backups of this
  1529.            file in the  case of  hardware failure,  fire, accidental  erasure,
  1530.            etc.
  1531.  
  1532.            The main KeyGen window displays a list of applications for which it
  1533.            can generate registration keys. When  you first install the  RegKey
  1534.            package, only  one application  will be  listed -  the RegKey  test
  1535.            program. When you write your own application that uses RegKey,  you
  1536.            can add that program to the list by choosing the "Add  Application"
  1537.            option (see page 29). To generate a registration key for one of the
  1538.            applications on the list, simply select the application and  choose
  1539.            the "Generate  Key"  option  (see page  31).  To  obtain  or  alter
  1540.            information  concerning  an  application,  such  as  the  type   of
  1541.            registration key generated or  the  generation/validation code set,
  1542.            select the application and choose the "Application Info" option. To
  1543.            remove  an  unwanted   application  from  the   list,  select   the
  1544.            application and choose  the "Delete Application"  option. When  you
  1545.            are finished with KeyGen, choose the "Close" option. Only one  copy
  1546.            of KeyGen should be running at any time.
  1547.  
  1548.            KeyGen also provides  you with  the option  of password  protecting
  1549.            applications. You can enter a password for an application when  you
  1550.            add  it   using  the   "Add  Application"   option,  or   you   can
  1551.            add/alter/remove a password  using the  "Application Info"  option.
  1552.            When a password has been entered for an application, that  password
  1553.            will be required to generate a registration key for the application
  1554.            or  to  access  or  alter   the  information  pertaining  to   that
  1555.            application.
  1556.  
  1557.            Once again, be sure  to maintain a backup  copy of your  KEYGEN.DAT
  1558.            file.
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  -----------------------------------------------------------------------------
  1569.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 28
  1570.  
  1571.  
  1572.  CREATING GENERATION/VALIDATION CODE SETS
  1573.  -----------------------------------------------------------------------------
  1574.  
  1575.            As is introduced in "Principles of  the RegKey System" on page  23,
  1576.            for  each  application   that  uses  RegKey   you  must  create   a
  1577.            generation/validation code set.  It is the uniqueness  of this code
  1578.            set that make the  registration keys for  one of your  applications
  1579.            different from those for any other program using RegKey. The secret
  1580.            generation code  is required  to generate  registration keys  for a
  1581.            specific application. The validation code is used when checking the
  1582.            validity of the registration key at application run time.
  1583.  
  1584.            The   RegKey    API   provides    a   function / procedure    named
  1585.            RegKeyNewCodeSet(),   that    can    be   used    to    create    a
  1586.            generation/validation code set for a new application.  However, the
  1587.            quickest and easiest way  to create a  new code set  is to use  the
  1588.            KeyGen program included in your RegKey package. KeyGen also  stores
  1589.            the new code set in its data file for your future reference. If you
  1590.            would prefer to write  your own program that  generates a code  set
  1591.            using   the   RegKeyNewCodeSet()   function/procedure,   see    the
  1592.            information on calling RegKeyNewCodeSet() in the section of part  4
  1593.            that deals with the programming language you are using.
  1594.  
  1595.            The RegKey generation and validation codes  are both represented as
  1596.            ten digit strings of numbers and upper-case letters. Although it is
  1597.            mathematically possible for  the validation code  to be  calculated
  1598.            from the generation code, the reverse is not true; there is no easy
  1599.            way to calculate  the generation  code given  the validation  code.
  1600.            Therefore, the process of  creating a new code set  involves RegKey
  1601.            calculating a  validation  code from  a  generation code  that  you
  1602.            provide.
  1603.  
  1604.            To create a code set for a new application (or version),  start the
  1605.            KeyGen utility as described on page 27. Select "New Application" to
  1606.            create a new code set, in  order to bring up the "New  Application"
  1607.            dialog box. Enter the name of the application for which you will be
  1608.            generating a new code  set. This name  is not used  as part of  the
  1609.            code set  generation  process;  it is  simply  used  by  KeyGen  to
  1610.            distinguish between code sets if you generate more than one.
  1611.  
  1612.            Next,  enter  the  10  character   generation   code  for  which  a
  1613.            corresponding validation code will  be calculated.  These two codes
  1614.            will form the new  code set.  The generation code  you enter should
  1615.            consist of numbers and upper case letters, and should be  different
  1616.            for each of your applications.
  1617.  
  1618.            KeyGen gives you the option of  protecting the  new code set with a
  1619.            password. This password can prevent other people who have access to
  1620.            your computer or  data files from  unauthorized access  to the  new
  1621.            generation/validation code  set.  KeyGen  will  also  require  this
  1622.            password to  be  entered  before a  new  registration  key  can  be
  1623.  
  1624.  -----------------------------------------------------------------------------
  1625.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 29
  1626.  
  1627.  
  1628.            generated for your application. If you choose to enter a  password,
  1629.            note that it will  not appear when typed.  Be very careful to  note
  1630.            the spelling and  capitalization of  the password  you choose;  the
  1631.            password will have  to be entered  identically in  the future.  The
  1632.            best passwords are  between six  and twelve  characters in  length.
  1633.            Remember that the password  you enter has no  effect on the  actual
  1634.            validation code that is generated - it only controls access to that
  1635.            information when stored within KeyGen.
  1636.  
  1637.            The "New  Application"  dialog  box also  allows  you  to  indicate
  1638.            whether your application will  be using user-entered or  file-based
  1639.            registration keys.  Again, this  information  does not  affect  the
  1640.            actual generation/validation codes.  This setting only controls the
  1641.            type of registration key that KeyGen will create,  if you choose to
  1642.            use KeyGen to generate registration keys for your application  (see
  1643.            "Generating Registration Keys" on page 31).  For information on the
  1644.            benefits of  file-based  vs. user-entered  registration  keys,  see
  1645.            "File-Base vs. User-Entered Registration Keys" on page 25.
  1646.  
  1647.            Once you  have  entered  the relevant  information  into  the  "New
  1648.            Application" dialog box,  choose "OK" to  calculate the  validation
  1649.            code that  corresponds  to the  generation  code you  entered.  The
  1650.            generation and validation codes  will now be  stored in the  KeyGen
  1651.            data file, KEYGEN.DAT. To view the generation and validation  codes
  1652.            for a particular application, select  that application in the  main
  1653.            KeyGen window, and  choose the  "Application Info"  option. If  you
  1654.            have password  protected  the  selected  application,  KeyGen  will
  1655.            prompt  for  the  application's  password  before  displaying   any
  1656.            information about the selected application.
  1657.  
  1658.            When  you  create  a  generation/validation  code  set  for  a  new
  1659.            application, you should  always write these  codes down  in a  safe
  1660.            location. Otherwise, if the  KeyGen data file  is lost or  damaged,
  1661.            you could loose the ability to generate registration keys for  your
  1662.            own software!
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  -----------------------------------------------------------------------------
  1681.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 30
  1682.  
  1683.  
  1684.  GENERATING REGISTRATION KEYS
  1685.  -----------------------------------------------------------------------------
  1686.  
  1687.            You will typically generate a registration key once for each  user,
  1688.            when they pay for  your software. Registration  keys may either  be
  1689.            generated using the KeyGen program included in your RegKey package,
  1690.            or they may be generated using your own utility which in turn calls
  1691.            upon RegKey to perform the actual registration key generation.  You
  1692.            will most likely  choose to  generate registration  keys using  the
  1693.            KeyGen program. However, if you wish to integrate the  registration
  1694.            key generation process  with another  program (such  as an  on-line
  1695.            registration system or an order entry system), you may perform  key
  1696.            generation by calling a RegKey API function/procedure.  For general
  1697.            information on  using the  KeyGen program,  see the  section  which
  1698.            begins  on  page  27.   For  information  on   calling  RegKey  API
  1699.            functions/procedures from your programming language, see part  four
  1700.            of this manual, which begins on page 46.
  1701.  
  1702.            If you are generating  a registration key using the KeyGen program,
  1703.            first start up KeyGen as described  in the section which begins  on
  1704.            page 27. Next select the application for which you wish to generate
  1705.            a registration key, and choose the  "Generate Key" option. The  key
  1706.            generation dialog box will now appear  on your screen. This  dialog
  1707.            box is used to provide information about the registration key to be
  1708.            generated. (If  you  have  not yet  added  information  about  your
  1709.            application to the KeyGen program, it  will not appear on the  list
  1710.            of  available   applications.   In   this   case,   see   "Creating
  1711.            Generation/Validation Code Sets" on page 29.)
  1712.  
  1713.            When generating a registration  key, you MUST  SUPPLY at least  the
  1714.            following two pieces of information:
  1715.  
  1716.           A.  The registration string, which is usually the user's name
  1717.           B.  A ten digit alphanumeric random seed
  1718.  
  1719.            Depending upon your  circumstances, the  following information  MAY
  1720.            ALSO BE REQUIRED:
  1721.  
  1722.           C.  If you are using KeyGen  to generate the registration key for a
  1723.               password protected application, this  password must be  entered
  1724.               to generate a registration key.
  1725.           D.  If you  are  writing  your own  key  generation  utility,  that
  1726.               utility must specify the generation code  for your application.
  1727.               (If you  are  using  KeyGen , it  automatically  provides  this
  1728.               information for the application you selected.)
  1729.           E.  When generating a file-base  registration key, you may  specify
  1730.               the filename to be used for the new registration key.
  1731.  
  1732.            To elaborate:
  1733.  
  1734.  
  1735.  
  1736.  -----------------------------------------------------------------------------
  1737.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 31
  1738.  
  1739.  
  1740.           A.  The registration s tring is usually  the user's  name, but  may
  1741.               also contain other information, such as registration key expiry
  1742.               data. For  more information  on  the registration  string,  see
  1743.               "Principles of the RegKey System" on page 23.
  1744.  
  1745.           B.  In order to generate a registration key, RegKey requires  a ten
  1746.               character alphanumeric string which it uses as a  simple random
  1747.               number seed. If this  string includes more than  ten character,
  1748.               the additional characters are ignored. A different  random seed
  1749.               should be chosen for each registration key that is generated.
  1750.  
  1751.           C.  If you are using KeyGen  to generate the  registration key, and
  1752.               you have entered a password for the selected  application, this
  1753.               password must  be  entered. The  password  portion of  the  key
  1754.               generation dialog box is enabled if  and only if a  password is
  1755.               required for this application. Note that the password  will not
  1756.               appear on the screen when it is typed. If an incorrect password
  1757.               is entered,  KeyGen will  refuse to  generate the  registration
  1758.               key.
  1759.  
  1760.           D.  If you  are  writing  your own  key  generation  utility,  that
  1761.               utility must specify the generation code  for your application.
  1762.               The ten digit  generation code  is passed  as a  string to  the
  1763.               registration  key  generation  function.  For   information  on
  1764.               creating a generation code, see "Creating Generation/Validation
  1765.               Code Sets" on page 29. (If you are using KeyGen to generate the
  1766.               registration key, it automatically provides the generation code
  1767.               for the application you selected.)
  1768.  
  1769.           E.  If you are  generating a file-based  registration key, you  may
  1770.               optionally specify the registration key filename to be used. If
  1771.               you do not specify a filename, RegKey will default to using the
  1772.               first eight alphabetical characters in the registration string,
  1773.               with a .KEY extension.  For instance, the default  filename for
  1774.               the registration string "Brian Pirie" would  be "BRIANPIR.KEY".
  1775.               Likewise, for  the  registration  string  "1-2-3  Clocks",  the
  1776.               default filename  would be  "CLOCKS.KEY". If  the  registration
  1777.               string  does  not  contain  any  alphabetical  characters,  the
  1778.               default filename is "REGISTER.KEY". If you explicitly specify a
  1779.               registration key filename, that filename may optionally include
  1780.               a path to the directory where the registration key  file should
  1781.               be created.  If  no  path/filename is  specified,  the  current
  1782.               directory is used by default.
  1783.  
  1784.               CAVEAT: If  a registration  key file  already  exists with  the
  1785.               specified filename, it will be overwritten by the new one.
  1786.  
  1787.            If you are using KeyGen to generate the registration key, choosing
  1788.            "OK" will cause a registration key to be generated, based upon the
  1789.            information entered. If  the "OK"  button  of the  key  generation
  1790.            dialog box is not  enabled,  be sure  that  you have  specified  a
  1791.  
  1792.  -----------------------------------------------------------------------------
  1793.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 32
  1794.  
  1795.  
  1796.            registration string, a valid 10-digit random  seed,  and a password
  1797.            if required. When  generating user-entered  registration keys,  the
  1798.            generated registration key will be  displayed in a separate  dialog
  1799.            box. You  will now  have the  option of  either generating  another
  1800.            registration key for the current  application, or returning to  the
  1801.            main KeyGen window. When generating a file-based registration  key,
  1802.            the registration key file  will be created  and another dialog  box
  1803.            will  appear  indicating  whether  or  not  you  wish  to  generate
  1804.            additional registration keys for the current application.
  1805.  
  1806.            If you  are  generating  registration keys  from  within  your  own
  1807.            program, key generation is  performed by one  of the following  two
  1808.            functions/procedures:
  1809.  
  1810.                 RegKeyGenerate()
  1811.                 RegKeyFileGenerate()
  1812.  
  1813.            The first  function/procedure  is  used  to  generate  user-entered
  1814.            registration keys, and  the second  is used  to generate  file-base
  1815.            registration keys. The registration string, generation code, random
  1816.            seed and other  information required for  key generation is  passed
  1817.            directly to  one  of these  functions/procedures.  In the  case  of
  1818.            RegKeyGenerate(), the 20 character registration key is returned  to
  1819.            your  program.  In  the  case  of  RegKeyFileGenerate(),   the  new
  1820.            registration key file is created.
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  -----------------------------------------------------------------------------
  1849.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 33
  1850.  
  1851.  
  1852.  VALIDATING REGISTRATION KEYS WITHIN YOUR PROGRAM
  1853.  -----------------------------------------------------------------------------
  1854.  
  1855.            In order  to provide  registration key  validation capabilities,  a
  1856.            portion of RegKey is linked into the executable (.EXE, .COM,  .DLL,
  1857.            etc.) file  of your  application. The  actual process  for  linking
  1858.            RegKey with  your program  varies  depending upon  the  programming
  1859.            language you are using. For more  information on doing this with  a
  1860.            particular language, consult Part Four of this manual (which begins
  1861.            on page 46) and/or your language's manual(s).
  1862.  
  1863.            To cause the registration key validation to be performed, you  call
  1864.            one of two RegKey functions/procedures, depending upon whether  you
  1865.            are using  user-entered  or  file-based  registration  keys.  These
  1866.            functions/procedures are as follows:
  1867.  
  1868.                 RegKeyValidate()         - For user-entered registration keys
  1869.                 RegKeyFileValidate()     - For file-based registration keys
  1870.  
  1871.            The registration key validation code for your application is passed
  1872.            to  either  RegKeyValidate()  or   RegKeyFileValidate()  as  a  ten
  1873.            character alphanumeric string. If  RegKeyValidate() is being  used,
  1874.            the registration string and registration key are also passed to the
  1875.            function. In the case that RegKeyFileValidate() is being used,  the
  1876.            registration key filename and string where the registration  string
  1877.            should be stored are passed to the function/procedure. In addition,
  1878.            a variable  is  passed  to  RegKeyValidate()/  RegKeyFileValidate()
  1879.            which will be set to indicate  whether your program should  operate
  1880.            in registered or unregistered mode. Based  on how RegKey sets  this
  1881.            variable, you can adjust the behavior of your program as you  wish.
  1882.            Both of these functions  return a value  indicating whether or  not
  1883.            they executed successfully.
  1884.  
  1885.            The RegKeyValidate() function requires the following parameters, in
  1886.            order:
  1887.  
  1888.            sRegString        The registration  string to  be validated.  This
  1889.                              sting  can  consist  of  up  to   either  65,535
  1890.                              characters, or the  maximum size  of strings  in
  1891.                              your programming language, whichever is less.
  1892.  
  1893.            sRegKey           A  twenty   character  string   containing   the
  1894.                              registration key  to  be validated  against  the
  1895.                              registration string.
  1896.  
  1897.            sValidationCode   A   ten   character   string   containing   your
  1898.                              applications validation code.
  1899.  
  1900.            sYourName         A string  containing  your  name,  if  you  have
  1901.                              registered RegKey. Otherwise, this should  be an
  1902.                              empty string.
  1903.  
  1904.  -----------------------------------------------------------------------------
  1905.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 34
  1906.  
  1907.  
  1908.  
  1909.            nYourKey          A   long   integer   containing   your    RegKey
  1910.                              registration key if you have  registered RegKey.
  1911.                              Otherwise
  1912.  
  1913.            peRegistered      The variable  where the  result of  registration
  1914.                              key  validation  should  be   stored.  Indicates
  1915.                              whether the program should operate in registered
  1916.                              or unregistered mode. See  section four of  this
  1917.                              manual for the  possible values of  peRegistered
  1918.                              in your programming language.
  1919.  
  1920.            Hence, a typical call to the RegKeyValidate() function might appear
  1921.            as follows (in no particular programming language):
  1922.  
  1923.                      result = RegKeyValidate( theRegistrationString,
  1924.                                               theRegistrationKey,
  1925.                                               myValidationCode,
  1926.                                               "A RegKey Programmer",
  1927.                                               0,
  1928.                                               isRegistered)
  1929.  
  1930.  
  1931.            The   RegKeyFileValidate()   function   requires   the   following
  1932.            parameters, in order:
  1933.  
  1934.            sFileName         The  filename  or  file  specification   of  the
  1935.                              registration key file. If this string  is empty,
  1936.                              *.KEY is used. You  will likely want to  specify
  1937.                              the path to  your application's main  directory,
  1938.                              where the registration key file would usually be
  1939.                              installed by the  user. For instance,  sFileName
  1940.                              might be "C:\MYAPP\*.KEY".
  1941.  
  1942.            sValidationCode   A   ten   character   string   containing   your
  1943.                              applications validation code.
  1944.  
  1945.            sYourName         A string  containing  your  name,  if  you  have
  1946.                              registered RegKey. Otherwise, this should  be an
  1947.                              empty string.
  1948.  
  1949.            nYourKey          A   long   integer   containing    your   RegKey
  1950.                              registration key if you have  registered RegKey.
  1951.                              Otherwise
  1952.  
  1953.            sRegString        A string  where  the registration  str ing (e.g.
  1954.                              user's name) retrieved from the registration key
  1955.                              file will be  stored. If  no valid  registration
  1956.                              key file  was  located,  RegKey will  return  an
  1957.                              empty string in this variable.
  1958.  
  1959.  
  1960.  -----------------------------------------------------------------------------
  1961.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 35
  1962.  
  1963.  
  1964.            cbMaxStringSize   The maximum  size  of the  registration  string,
  1965.                              expressed in the string size conventions used by
  1966.                              the host  programming  language.  In  C  or  C++
  1967.                              programs, this  should  contain  the  number  of
  1968.                              bytes allocated for  the string  and the  string
  1969.                              termination character. In Pascal, this should be
  1970.                              the number  of  characters  specified  when  the
  1971.                              string was  declared,  or  255 if  no  size  was
  1972.                              specified. In BASIC, this specifies  the maximum
  1973.                              number of characters that RegKey should retrieve
  1974.                              for the registration string. For variable-length
  1975.                              strings in  QuickBASIC, this  can be  any  value
  1976.                              between 1 and  255. For variable-length  strings
  1977.                              in Visual Basic, this can be any value between 1
  1978.                              and 30,000.
  1979.  
  1980.            peRegistered      The variable  where the  result of  registration
  1981.                              key  validation  should  be   stored.  Indicates
  1982.                              whether the program should operate in registered
  1983.                              or unregistered mode. See  section four of  this
  1984.                              manual for the  possible values of  peRegistered
  1985.                              in your programming language.
  1986.  
  1987.            Hence, a typical  call to the  RegKeyFileValidate() function might
  1988.            appear as follows (in no particular programming language):
  1989.  
  1990.                      result = RegKeyFileValidate(  "*.KEY",
  1991.                                                    myValidationCode,
  1992.                                                    "A RegKey Programmer",
  1993.                                                    0,
  1994.                                                    registrationString,
  1995.                                                    50,
  1996.                                                    isRegistered)
  1997.  
  1998.            Typically, you will  store the value  returned in the  peRegistered
  1999.            parameter in one or more global variables, that will be  accessible
  2000.            at any time your program needs  to know whether it is operating  in
  2001.            registered or unregistered  mode. There are  no limitations on  how
  2002.            you  adjust  your   program's  behavior   between  registered   and
  2003.            unregistered modes.
  2004.  
  2005.            For an example of how to perform registration key validation within
  2006.            your programming  language, see  the source  code for  the  DemoApp
  2007.            example program. The RegKey package includes equivalent source code
  2008.            of DemoApp in the C, C++, Turbo Pascal, QuickBASIC and Visual Basic
  2009.            languages.
  2010.  
  2011.            For  more   information   on  calling   the   RegKeyValidate()   or
  2012.            RegKeyFileValidate() functions,  see the  section of  part four  of
  2013.            this manual that deals with the programming language you are using.
  2014.  
  2015.  
  2016.  -----------------------------------------------------------------------------
  2017.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 36
  2018.  
  2019.  
  2020.  METHODS FOR ADDING EXPIRY INFORMATION
  2021.  -----------------------------------------------------------------------------
  2022.  
  2023.            Often, you  will want  to provide  users of  your software  with  a
  2024.            single registration key that  will work with  all versions of  your
  2025.            application. This is exactly what you achieve by simply  generating
  2026.            registration keys with the user's name as the registration  string,
  2027.            and using the same generation/ validation code set for all versions
  2028.            of your  application. However,  in some  cases  you may  only  want
  2029.            registration keys  to function  with  particular versions  of  your
  2030.            application. Alternatively, you  may wish  to limit  the length  of
  2031.            time for which the registration key  will continue to function.  In
  2032.            each of these cases, you are adding some form of expiry information
  2033.            to your registration keys.
  2034.  
  2035.            There are two basic methods for adding expiry information to RegKey
  2036.            registration keys:
  2037.  
  2038.           1.  Using different generation/validation  code set s for different
  2039.               versions of your application.
  2040.  
  2041.           2.  Including expiry information in the registration string.
  2042.  
  2043.            The first  method,  where  you are  using  different code  sets for
  2044.            different versions of your application, is only applicable when you
  2045.            wish to  generate registration  keys that  only work  with  certain
  2046.            versions of your application. If you wish to include any other form
  2047.            of expiry information  in your registration keys,  you must use the
  2048.            second  method,  where   this  information  is   imbedded  in   the
  2049.            registration string.  Below, both of these methods are described in
  2050.            detail:
  2051.  
  2052.           1.  If you  wish different  registration keys  to  be required  for
  2053.               different versions of your  applications, the easiest  approach
  2054.               is  to  use  different  generation/validation  code   sets  for
  2055.               versions that you wish to require different  registration keys.
  2056.               For instance, if you wish to require the user to pay to upgrade
  2057.               from one major  version of  your application to  the next,  you
  2058.               could use one code  set for the 1.x  version(s), a second  code
  2059.               set for the 2.x version(s), and so on. If you are  using KeyGen
  2060.               to generate registration keys, you would then end up  with both
  2061.               "MyApp  1.x"  and  "MyApp   2.x"  in  the  list   of  available
  2062.               applications. When either a  new user purchases version  2.x of
  2063.               your application, or a current user pays to upgrade  to version
  2064.               2.x, you would generate a  new registration key using  the code
  2065.               set for version 2.x.
  2066.  
  2067.               If you only wish to add simple by-version expiry information to
  2068.               your registration keys, this is probably the preferable method,
  2069.               as it does not require the expiry information to be included in
  2070.               the registration  string. This  is particularly  relevant  when
  2071.  
  2072.  -----------------------------------------------------------------------------
  2073.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 37
  2074.  
  2075.  
  2076.               using user-entered registration keys, as the user does not have
  2077.               to enter  the  expiry method  in  addition  to their  name  and
  2078.               registration key.
  2079.  
  2080.           2.  The second, more flexible option for adding  expiry information
  2081.               to your registration keys is  to imbed this information  in the
  2082.               registration string. In this case, the registration string does
  2083.               not only contain the user's name, but also includes information
  2084.               such as the version or version(s) registered or the expiry date
  2085.               of the registration key.  Since the registration key  generated
  2086.               for the  registration  string  proves its  validity,  the  user
  2087.               cannot change  the  information  included in  the  registration
  2088.               string without invalidating the registration key. When  you use
  2089.               this approach, it is important that you choose a  strict format
  2090.               for the registration key. For instance, if you wish  to include
  2091.               the user's  name and  the date  of expiry  in the  registration
  2092.               string, you might decide to format the string with  four digits
  2093.               for the year, followed by a  dash (`-') followed by  two digits
  2094.               for the month, and  so on. You might  also decide that a  comma
  2095.               and a space  will separate the  date and  user's name. In  this
  2096.               case, the registration string might appear as follows:
  2097.  
  2098.                      1997-11-28, Brian Pirie
  2099.  
  2100.               While the  method of  using different  code  sets can  be  used
  2101.               equally well  with  file-based  and  user-entered  registration
  2102.               keys, imbedding expiry  information in  the registration string
  2103.               is better suited  to file-based  registration keys. While  this
  2104.               method can also be used with user-entered registration keys, it
  2105.               does require the user to manually enter any expiry information.
  2106.               If you do  choose to  use user-entered  registration keys  with
  2107.               this method, you may wish  to provide some mechanism  to ensure
  2108.               that the  registration string  is correctly  entered into  your
  2109.               application. One approach  would be  to break the  registration
  2110.               string into a number of fields, requiring the user to enter the
  2111.               value for each field. You would then construct the registration
  2112.               string at application  run-time, and  use RegKey  to check  the
  2113.               validity of the  registration key  against this  string. As  an
  2114.               example, your program might have a registration dialog box with
  2115.               the following fields:
  2116.  
  2117.                                    Your Full Name : Brian Pirie
  2118.                       Year of Registration Expiry : 1997
  2119.                      Month of Registration Expiry : November
  2120.                        Day of Registration Expiry : 28
  2121.                                  Registration Key : KT4BP0TRX6AQ2MJK8KFU
  2122.  
  2123.               From this  information,  you  could generate  an  appropriately
  2124.               formatted registration string, such as:
  2125.  
  2126.                      1997-11-28, Brian Pirie
  2127.  
  2128.  -----------------------------------------------------------------------------
  2129.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 38
  2130.  
  2131.  
  2132.  
  2133.               If, on the  other hand, you  use file-based registration  keys,
  2134.               this difficulty is avoided, as the registration string with any
  2135.               expiry information is stored in the registration key file.
  2136.  
  2137.               Imbedding expiry information in the registration string enables
  2138.               many variations on the use of RegKey. Possibilities include:
  2139.  
  2140.                      - Selling registration keys  that work with  the current
  2141.                        and next version of your software.
  2142.  
  2143.                      - Giving the  user  the option  of  either purchasing  a
  2144.                        "life-time" registration  for  all  versions  of  your
  2145.                        application, or purchasing a  cheaper registration for
  2146.                        only the current version.
  2147.  
  2148.                      - Implementing  a  pay-by-use  system   where  the  user
  2149.                        receives a new registration key when they pay for more
  2150.                        time. In  such  a  system,  a registration  key  could
  2151.                        expire after a certain date or  after a certain number
  2152.                        of uses.
  2153.  
  2154.                      - Providing multiple  levels of  functionality depending
  2155.                        upon the level of the user's registration.
  2156.  
  2157.                      - Creating special  "beta-user"  registration keys  that
  2158.                        work for  both beta-test  and final  release versions,
  2159.                        while "normal" registration  keys work only  for final
  2160.                        release versions.
  2161.  
  2162.                      - Implementing an  on-line  "trial" registration  system
  2163.                        that  allows   the   user   to   obtain   trail-period
  2164.                        registration   keys   without   purchasing    a   full
  2165.                        registration.
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  -----------------------------------------------------------------------------
  2185.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 39
  2186.  
  2187.  
  2188.  SECURITY ISSUES
  2189.  -----------------------------------------------------------------------------
  2190.  
  2191.            When using  RegKey in  any program,  it is  your responsibility  to
  2192.            decide whether employing RegKey alone  provides enough security for
  2193.            your needs. While using RegKey  alone does provide enough  security
  2194.            for the vast majority of applications, there may be times when  you
  2195.            wish to augment  or combine RegKey  with other software  protection
  2196.            mechanisms. This section provides a brief discussion of some of the
  2197.            issues you may wish to consider when using RegKey, and attempts  to
  2198.            answer the question "how secure is RegKey?"
  2199.  
  2200.            When  evaluating   any   software  protection   scheme,   such   as
  2201.            registration key mechanisms, it is important  to keep in mind  that
  2202.            no such mechanism is 100% secure. If your program can be  executed,
  2203.            it can  be reverse-engineered  and altered.  Fortunately, the  fact
  2204.            that it is possible to beat  a software protection scheme does  not
  2205.            necessarily render that  scheme as ineffective.  In general, it  is
  2206.            sufficient for  a software  protection  mechanism to  be  difficult
  2207.            enough to beat that most users will be more likely to pay for  your
  2208.            software than attempt to "beat the system". Yet as was said before,
  2209.            it is up to you  to decide how much  security you require for  your
  2210.            software.
  2211.  
  2212.            In general, there are three basic  ways in which someone might  try
  2213.            to bypass the software protection of a program that uses RegKey.
  2214.  
  2215.           1.  By always using the program in unregistered mode
  2216.           2.  By producing a "counterfeit" registration key for your program
  2217.           3.  By "hacking" or somehow  modifying your software in  order that
  2218.               it operates in registered mode without a valid registration key
  2219.               being present.
  2220.  
  2221.            Each of these possibilities are discussed below:
  2222.  
  2223.           1.  By far the most common  way that users bypass  registration key
  2224.               systems is by  always using  the program  in unregistered  mode
  2225.               without paying for it. The likelihood of users doing  this with
  2226.               your software depends largely upon the type of  application and
  2227.               the incentives you  offer for registering.  In some cases,  the
  2228.               majority  of  people  using   a  software  package  that   uses
  2229.               registration keys  will be  using  it without  registering.  In
  2230.               other cases, almost everyone using the software will  have paid
  2231.               to register it.
  2232.  
  2233.               There are a number of things that you can do to encourage users
  2234.               to pay for your software  rather than using it  in unregistered
  2235.               mode:
  2236.  
  2237.               -  If the output of  your software will be  seen by many people
  2238.                  in addition to the  user who is  responsible for registering
  2239.  
  2240.  -----------------------------------------------------------------------------
  2241.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 40
  2242.  
  2243.  
  2244.                  it (such as communications  software, on-line bulletin board
  2245.                  software, programming library or other program that produces
  2246.                  unalterable  output),  then  displaying   or  outputting  an
  2247.                  "unregistered" message can be  sufficient to encourage users
  2248.                  to pay  for your  software. In  this case,  the unregistered
  2249.                  message has the potential  to advertise to  many people that
  2250.                  it is an evaluation copy and must be paid for.
  2251.  
  2252.               -  A common  and  effective  incentive  to  encourage users  to
  2253.                  register software is the enabling of additional capabilities
  2254.                  when  operating   in  registered   mode.   These  additional
  2255.                  capabilities could be the additional helpful features for an
  2256.                  application, additional  "levels" of  a video  game,  or the
  2257.                  removal  of  demonstration-version  limitations  such  as  a
  2258.                  maximum data file size. If you  are taking this approach, be
  2259.                  careful not  to  cripple  your  software's  capabilities  in
  2260.                  unregistered  mode  too   severely.  If  the   user  becomes
  2261.                  frustrated with  your software,  it is  unlikely   that they
  2262.                  will want to pay for it. Likewise, you  will want to be sure
  2263.                  that the  user has  an opportunity  to  examine all  of your
  2264.                  software's important capabilities.
  2265.  
  2266.               -  Another common incentive is to  offer additional services to
  2267.                  registered users,  such  as  printed documentation,  product
  2268.                  support, free upgrade to new versions, source code, etc.
  2269.  
  2270.               -  Another possible approach is to have your software only work
  2271.                  for a certain period of time without registering. To make it
  2272.                  more  difficult  for   users  to   bypass  this   scheme  by
  2273.                  reinstalling  the   software,  you   might  want   to  store
  2274.                  information  about   the  date   and  time   of   the  first
  2275.                  installation in your program's data file (if applicable).
  2276.  
  2277.               -  An alternative to causing  the software itself  to expire is
  2278.                  to require the user  to obtain a  temporary "evaluation" key
  2279.                  from you  to even  operate  in unregistered  mode.  This key
  2280.                  could expire after any  length of time you  choose. For more
  2281.                  information on  adding  expiry information  to  registration
  2282.                  keys, see the section that begins on page 37.
  2283.  
  2284.  
  2285.           2.  A second way  a user  might try  to bypass  a RegKey  protected
  2286.               application is by  producing a  "counterfeit" registration  key
  2287.               for your  software.  However, RegKey  is  designed to  make  it
  2288.               extremely difficult to do this. There are two  conceivable ways
  2289.               someone might try to generate a counterfeit RegKey registration
  2290.               key:
  2291.  
  2292.               A  by an exhaustive search of all possible registration keys
  2293.               B  by determining your application's  generation code and using
  2294.                  RegKey's KeyGen program to produce a registration key.
  2295.  
  2296.  -----------------------------------------------------------------------------
  2297.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 41
  2298.  
  2299.  
  2300.  
  2301.               An exhaustive  search  would not  be  feasible, even  with  the
  2302.               world's fastest supercomputer. There  are nearly 2^96  possible
  2303.               RegKey registration keys, of which nearly 2^48 are valid  for a
  2304.               given registration string. This means that on average, 2^47  (1
  2305.               followed by 14 zeros) registration keys must be tried  before a
  2306.               valid registration key is  found. To put  this into context,  a
  2307.               fully optimized version of the RegKeyValidate () function would
  2308.               require over more than 1 millisecond to determine  the validity
  2309.               of a RegKey registration key on a 66-Mhz Pentium based machine.
  2310.               Even being able to test 1000 registration keys per second, such
  2311.               a machine  would require  over 4,400  years to  guess a  RegKey
  2312.               registration key on average.
  2313.  
  2314.               Determining  the  generation  code   for  your  application  by
  2315.               guessing would  be  just as  difficult  as guessing  a  correct
  2316.               registration key. Also, although  a RegKey validation code  can
  2317.               be quickly calculated from the generation code, the  reverse is
  2318.               not the case. There is no known mathematical method  that would
  2319.               allow you to  quickly determine the  generation code given  the
  2320.               validation code. As  a result,  even if  the user  was able  to
  2321.               obtain the validation code  from your application's  executable
  2322.               file(s), they  would be  no closer  to  knowing the  generation
  2323.               code.
  2324.  
  2325.  
  2326.           3.  A third way someone might try to defeat a program  using RegKey
  2327.               is by  someone modifying  the program  to  cause it  to  always
  2328.               operate in registered  mode. The vast  majority of users  would
  2329.               not have the ability to do  this. However, there is  always the
  2330.               fear that someone  with the ability  to do  so may "hack"  your
  2331.               program and even distribute an altered version to  other users.
  2332.               While it  is  very  seldom  that  this  scenario  causes  major
  2333.               problems in  reality,  you may  still  wish  to take  steps  to
  2334.               further protect your program from "hacking".
  2335.  
  2336.               In any program using RegKey,  the weakest link is  generally at
  2337.               the point  where  the  program passes  control  to  the  RegKey
  2338.               routines. As  a result  you may  want to  somehow encrypt  (see
  2339.               glossary) or check  the validity of  this code  at run time.  A
  2340.               full discussion of such techniques is beyond the scope  of this
  2341.               manual. If you  wish to  add further robustness  to the  RegKey
  2342.               code itself, you  may wish  to obtain the  source code  package
  2343.               (see page 13) to make such modifications.
  2344.  
  2345.               If you are using RegKey with Visual Basic , you should consider
  2346.               checking the  validity  of the  RegKey  DLL  at run  time.  For
  2347.               instance, your  program could  locate the  RK30VB.DLL file  and
  2348.               calculate a checksum, CRC-32 or other hash value for  the file.
  2349.               That value could  then be  compared with an  expected value  to
  2350.               determine whether the DLL has been altered.
  2351.  
  2352.  -----------------------------------------------------------------------------
  2353.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 42
  2354.  
  2355.  
  2356.  TROUBLESHOOTING GUIDE
  2357.  -----------------------------------------------------------------------------
  2358.  
  2359.            This section provides a guide to solving common problems when using
  2360.            the RegKey system. If the suggestions  in this section do not  help
  2361.            in solving your problem, please feel more than free to get in touch
  2362.            with me. For information on how to reach me, see page 69.
  2363.  
  2364.  
  2365.            PROBLEM
  2366.            KeyGenW complains that CTL3DV2.DLL is not installed
  2367.  
  2368.            POSSIBLE SOLUTION
  2369.            The CTL3DV2.DLL file,  included in  your RegKey  package, must  be
  2370.            placed    in    the    Windows    system    directory    (typically
  2371.            C:\WINDOWS\SYSTEM). Ensure that this file  DOES NOT also reside  in
  2372.            the current default directory,  or the directory where  KEYGENW.EXE
  2373.            is located.
  2374.  
  2375.  
  2376.  
  2377.            PROBLEM
  2378.            KeyGenW does not list applications that have been previously added
  2379.  
  2380.            POSSIBLE SOLUTION
  2381.            Ensure that the  current default directory  is the same  as it  was
  2382.            when KeyGenW was originally run, in order that the same  KEYGEN.DAT
  2383.            file can be located.
  2384.  
  2385.  
  2386.  
  2387.            PROBLEM
  2388.            Program using RegKey does not recognize a valid registration key
  2389.  
  2390.            POSSIBLE SOLUTIONS
  2391.            Check  that  the  program  is   using  the  validation   code  that
  2392.            corresponds to the generation code used  to create the registration
  2393.            key. Also  check  that the  peRegistered  parameter passed  to  the
  2394.            RegKeyValidate()  or   RegKeyFileValidate()   function   is   being
  2395.            correctly tested in your  program. If file-based registration  keys
  2396.            are being used, ensure that the registration key file is placed  in
  2397.            the current default directory  (depending upon your  circumstances,
  2398.            this may  be the  directory from  which  you started  Windows,  the
  2399.            directory  from  which   you  started  the   application  or   your
  2400.            programming language, or the directory where the application's .EXE
  2401.            file is located. If you are  unsure as to what the current  default
  2402.            directory is, explicitly pass the location of the registration  key
  2403.            file to RegKeyFileValidate(). (i.e., "C:\MYAPP\*.KEY"). Also ensure
  2404.            that only one file with a .KEY extension exists in this directory.
  2405.  
  2406.  
  2407.  
  2408.  -----------------------------------------------------------------------------
  2409.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 43
  2410.  
  2411.  
  2412.  
  2413.            PROBLEM
  2414.            C or C++ program using RegKey will not compile
  2415.  
  2416.            POSSIBLE SOLUTIONS
  2417.            If you receive unexplained errors during the compile phase,  ensure
  2418.            that the REGKEY.H  file is  "#include"ed in  your program's  source
  2419.            file, and ensure  that the correct  format for  calling the  RegKey
  2420.            functions is being used. If  you receive unexplained errors  during
  2421.            the linking phase, ensure that you are linking with the appropriate
  2422.            RegKey library file for the target environment (DOS or Windows) and
  2423.            memory model that you are using.  If you are experiencing  problems
  2424.            linking in small, compact or medium memory models, and suspect that
  2425.            the code or data segments may  be exceeding 64K in size, try  using
  2426.            the large memory model.
  2427.  
  2428.  
  2429.            PROBLEM
  2430.            QuickBASIC program using RegKey will not execute
  2431.  
  2432.            POSSIBLE SOLUTIONS
  2433.            Ensure that the  RegKey Quick Library,  REGKEYQB.QLB is located  in
  2434.            the current  directory and  that QuickBASIC  has  loaded this  file
  2435.            (specify /LREGKEYQB.QLB on the QB  command line). Also ensure  that
  2436.            the REGKEY.BI  file is  included  using the  $INCLUDE  metacommand.
  2437.            Check that you are using the correct syntax for calling the  RegKey
  2438.            functions.
  2439.  
  2440.  
  2441.  
  2442.            PROBLEM
  2443.            QuickBASIC program using RegKey will not compile to .EXE file
  2444.  
  2445.            POSSIBLE SOLUTIONS
  2446.            Ensure that the RegKey stand-alone library, REGKEYQB.LIB is located
  2447.            in the correct directory and that QuickBASIC  is configured to link
  2448.            your program with  this library (specify  /LREGKEYQB.QLB on the  QB
  2449.            command line).
  2450.  
  2451.  
  2452.  
  2453.            PROBLEM
  2454.            Turbo Pascal program using RegKey will not compile or execute
  2455.  
  2456.            POSSIBLE SOLUTIONS
  2457.            Ensure that you have built the  .TPU unit for the version of  Turbo
  2458.            Pascal you are using,  and named this file  RegKeyD.TPU for DOS  or
  2459.            RegKeyW.TPU for Windows.  Also ensure that  your program refers  to
  2460.            the RegKeyD / RegKeyW  unit in the uses  statement. Check that  you
  2461.            are using the correct format for calling a RegKey function.
  2462.  
  2463.  
  2464.  -----------------------------------------------------------------------------
  2465.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 44
  2466.  
  2467.  
  2468.  
  2469.  
  2470.            PROBLEM
  2471.            Visual Basic program using RegKey will not run
  2472.  
  2473.            POSSIBLE SOLUTIONS
  2474.            Ensure that the RK30VB.DLL file is installed in the Windows  system
  2475.            directory. Also ensure that the REGKEYVB.BAS module is included  in
  2476.            the Visual Basic project window for  your program.  Also check that
  2477.            you are using the correct format for  calling the RegKey functions.
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  -----------------------------------------------------------------------------
  2521.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 45
  2522.  
  2523.  
  2524.  -----------------------------------------------------------------------------
  2525.  PART 4: LANGUAGE-SPECIFIC INFORMATION
  2526.  -----------------------------------------------------------------------------
  2527.  
  2528.  
  2529.  
  2530.            This portion of the RegKey manual  describes how to use the  RegKey
  2531.            system with various programming languages, and is divided into  the
  2532.            following sections:
  2533.  
  2534.                 Using RegKey with C or C++..................................46
  2535.                 Using RegKey with QuickBASIC................................54
  2536.                 Using RegKey with Visual Basic..............................60
  2537.                 Using RegKey with Turbo Pascal..............................61
  2538.                 Using RegKey with Other Languages or Operating Systems......68
  2539.  
  2540.            Since these  sections  build on  the  language-neutral  information
  2541.            presented in Part 3 of this manual, you should read Part 3 and have
  2542.            an understanding  of the  principles of  the RegKey  system  before
  2543.            proceeding to these sections. (Part 3 begins on page 18.)
  2544.  
  2545.  
  2546.  
  2547.  USING THE REGKEY SYSTEM WITH C OR C++
  2548.  -----------------------------------------------------------------------------
  2549.  
  2550.            This section describes  how to use  the RegKey  system in  programs
  2551.            written with C or C++. Specific  information is provided for  using
  2552.            RegKey with  C  and  C++  compilers  from  Microsoft  and  Borland,
  2553.            including  Borland  Turbo  C,  Borland  Turbo  C++,  Borland   C++,
  2554.            Microsoft C,  Microsoft  Quick  C, Microsoft  C/C++  and  Microsoft
  2555.            Visual C++. General information is  also provided for using  RegKey
  2556.            with other C  or C++ compilers.  The information  provided here  is
  2557.            pertinent to DOS, Windows and other operating systems.
  2558.  
  2559.            If you are using  a language or compiler  that is not  specifically
  2560.            discussed in this manual, the information in this section may  also
  2561.            be of  use  to you.  The  manuals included  with  many  programming
  2562.            languages provide information on how to call C language  functions.
  2563.            In these  cases, you  will need  to  know the  specifics of  the  C
  2564.            language function prototypes which are described in this section.
  2565.  
  2566.            In order to call the RegKey functions from a C or C++ program,  you
  2567.            must:
  2568.  
  2569.           1.  Include the  RegKey  header  file  at  the  beginning  of  your
  2570.               program's source code file(s), using the #include statement:
  2571.  
  2572.                      #include "regkey.h"
  2573.  
  2574.  
  2575.  
  2576.  -----------------------------------------------------------------------------
  2577.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 46
  2578.  
  2579.  
  2580.               Ensuring  that  the  REGKEY.H  file  is  located  in  the  same
  2581.               directory as  your program's  source code.  Alternatively,  you
  2582.               could place the  REGKEY.H file  in the same  directory as  your
  2583.               compiler's  standard  header  files.  In  this  case,   most  C
  2584.               compilers will require  you to use  angled brackets instead  of
  2585.               double quotes in the #include statement, as follows:
  2586.  
  2587.                      #include <regkey.h>
  2588.  
  2589.           2.  Link with the appropriate RegKey library file for  the platform
  2590.               (DOS or Windows) and memory  model you are using.  The included
  2591.               library files are as follows:
  2592.  
  2593.                      REGKEYSD.LIB        DOS, tiny and small memory models
  2594.                      REGKEYCD.LIB        DOS, compact memory model
  2595.                      REGKEYMD.LIB        DOS, medium memory model
  2596.                      REGKEYLD.LIB        DOS, large and huge memory models
  2597.                      REGKEYSD.LIB        Windows, small memory model
  2598.                      REGKEYCD.LIB        Windows, compact memory model
  2599.                      REGKEYMD.LIB        Windows, medium memory model
  2600.                      REGKEYLD.LIB        Windows, large and huge memory models
  2601.  
  2602.               The actual method  for configuring  your C or  C++ compiler  to
  2603.               link with  an additional  library varies  depending upon  which
  2604.               compiler you  are using.  You  should consult  your  compiler's
  2605.               manual for detailed information on how  to do this. If  you are
  2606.               using the Borland Turbo  C IDE, you should  create a text  file
  2607.               with a .PRJ extension, and list  the name of your  program's .C
  2608.               source file(s) along with the name of the RegKey library to use
  2609.               in the .PRJ  file. If you  are using the  Borland Turbo C++  or
  2610.               Borland C++ IDE,  you should  create a project  file using  the
  2611.               Project|Open  menu  option,  again  adding  the  name  of  your
  2612.               program's source  file(s) along  with the  name  of the  RegKey
  2613.               library to use. If you are using the Microsoft Quick C IDE, you
  2614.               should use the Make|Set Program List and Make|Edit Program List
  2615.               menu options to include  both your program's .C  source file(s)
  2616.               and the appropriate library  files. If you are  using Microsoft
  2617.               the Visual C++ IDE, you  should choose Project|Edit to  add the
  2618.               name of the RegKey  library to your project.  If you are  using
  2619.               any of these C or C++ compilers from the command line, you must
  2620.               specify the appropriate link  parameters to cause your  program
  2621.               to be linked with a RegKey library.
  2622.  
  2623.            The following  example C  / C++  programs  included in  the  RegKey
  2624.            package illustrate how you can call  a RegKey function from  within
  2625.            your program:
  2626.  
  2627.                 DEMOAPPD.C     DOS C version of DemoApp
  2628.                 DEMOAPPW.C     Windows C version of DemoApp
  2629.                 DEMOAPPD.CPP   DOS object-oriented C++ version of DemoApp
  2630.                 DEMOAPPW.CPP   Windows object-oriented C++ version of DemoApp
  2631.  
  2632.  -----------------------------------------------------------------------------
  2633.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 47
  2634.  
  2635.  
  2636.  
  2637.            When calling either of  the registration key validation  functions,
  2638.            RegKeyValidate() or RegKeyFileValidate(), the result is returned in
  2639.            an enum of type RKVALID. To  declare a variable to hold the  result
  2640.            of registration key validation, you would use something similar  to
  2641.            the follows:
  2642.  
  2643.                 RKVALID registeredMode;
  2644.  
  2645.            The address  of this  variable is  passed to  the registration  key
  2646.            validation function using the C or C++ address-of operator (&),  as
  2647.            follows:
  2648.  
  2649.                 RegKeyValidate(szRegString, szRegKey, "KIXE4UB52K", "", 0,
  2650.                                ®isteredMode);
  2651.  
  2652.            This variable  can  have  one of  two  values,  RK_UNREGISTERED  or
  2653.            RK_REGISTERED. Therefore, at  any point in  your program where  you
  2654.            wish to  test whether  the program  is operating  in registered  or
  2655.            unregistered mode, you might include an if statement similar to the
  2656.            following:
  2657.  
  2658.                 if(registeredMode == RK_REGISTERED)
  2659.                    {
  2660.                    printf("Registered mode\n");
  2661.                    }
  2662.                 else
  2663.                    {
  2664.                    printf("Unregistered mode\n");
  2665.                    }
  2666.  
  2667.            Below, the calling format for each  of the RegKey API functions  is
  2668.            documented from  the  perspective  of the  C  and  C++  programming
  2669.            languages:
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  -----------------------------------------------------------------------------
  2689.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 48
  2690.  
  2691.  
  2692.  -----------------------------------------------------------------------------
  2693.  LANGUAGE  C and C++
  2694.  
  2695.  FUNCTION  RegKeyNewCodeSet()
  2696.  
  2697.  PURPOSE   Creates a new generation / validation code set
  2698.  
  2699.  FORMAT    RKRETURN RegKeyNewCodeSet(
  2700.                 const char FAR *szGenerationCode,
  2701.                 char FAR *szValidationCode);
  2702.  
  2703.  RETURNS   Type RKRETURN. RK_SUCCESS on success, RK_FAILURE on failure.
  2704.  
  2705.  PARAMS    szGenerationCode    - INPUT: 10-digit generation code string
  2706.            szValidationCode    - OUTPUT: 10-digit validation code string
  2707.  
  2708.  NOTES     Generates a  registration  key  validation code corresponding  to a
  2709.            generation code.  This set  of generation  and validation  codes is
  2710.            unique for each application using RegKey, and determines the unique
  2711.            registration key that corresponds to a particular user's name.  The
  2712.            secret generation code is used at registration key generation time,
  2713.            and  the  corresponding  validation   code  is  used  within   your
  2714.            application when validating a registration key. The validation  and
  2715.            generation codes are  each represented  as a  ten-digit strings  of
  2716.            numbers and  upper-case letters.  Hence both  parameters should  be
  2717.            declared as arrays of characters of  at least 11 elements in  size.
  2718.            This function is called by KeyGen or your own utility,  and is only
  2719.            used once for each application using RegKey.
  2720.  
  2721.            The concepts of  code set creation are  introduced in  the section
  2722.            which begins on page 29.
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  -----------------------------------------------------------------------------
  2745.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 49
  2746.  
  2747.  
  2748.  -----------------------------------------------------------------------------
  2749.  LANGUAGE  C and C++
  2750.  
  2751.  FUNCTION  RegKeyGenerate()
  2752.  
  2753.  PURPOSE   Creates a user-entered type registration key
  2754.  
  2755.  FORMAT    RKRETURN RegKeyGenerate(
  2756.                 const char FAR *szRegString,
  2757.                 const char FAR *szGenerationCode,
  2758.                 const char FAR *szRandomSeed,
  2759.                 char FAR *szRegKey);
  2760.  
  2761.  RETURNS   Type RKRETURN. RK_SUCCESS on success, RK_FAILURE on failure.
  2762.  
  2763.  PARAMS    szRegString         - INPUT: Registration string
  2764.            szGenerationCode    - INPUT: Application's generation code string
  2765.            szRandomSeed        - INPUT: Random number seed string
  2766.            szRegKey            - OUTPUT: 20-digit registration key string
  2767.  
  2768.  NOTES     Generates a  registration  key for  a  particular user,  using  the
  2769.            secret generation code  corresponding to  a particular  application
  2770.            (as passed  to  RegKeyNewCodeSet()).  The  registration  string  is
  2771.            usually the name of the registered user, but may also contain other
  2772.            information, such as the version registered or date of expiry.  The
  2773.            registration string may be zero to 64K characters in length, and is
  2774.            null-terminated. The registration  key is returned  as a string  of
  2775.            letters and upper-case letters. The  string pointed to by  szRegKey
  2776.            must be large enough  to hold 20 digits,  plus a string  terminator
  2777.            character. szRandomSeed should contain 10 random numbers and upper-
  2778.            case numbers,  which  are  required  during  the  registration  key
  2779.            generation process.
  2780.  
  2781.            This function  is called  by KeyGen or  your own  registration  key
  2782.            generation utility, each time a registration key is generated for a
  2783.            new user. This function is used for user-entered registration keys;
  2784.            compare with RegKeyFileGenerate().
  2785.  
  2786.            Concepts of  registration  key  generation are  introduced  in  the
  2787.            section which begins on page 31.
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  -----------------------------------------------------------------------------
  2801.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 50
  2802.  
  2803.  
  2804.  -----------------------------------------------------------------------------
  2805.  LANGUAGE  C and C++
  2806.  
  2807.  FUNCTION  RegKeyValidate()
  2808.  
  2809.  PURPOSE   Checks the validity of a user-entered registration key
  2810.  
  2811.  FORMAT    RKRETURN RegKeyValidate(
  2812.                 const char FAR *szRegString,
  2813.                 const char FAR *szRegKey,
  2814.                 const char FAR *szValidationCode,
  2815.                 const char FAR *szYourName,
  2816.                 unsigned long int nYourKey,
  2817.                 RKVALID FAR *peRegistered);
  2818.  
  2819.  RETURNS   Type RKRETURN. RK_SUCCESS on success, RK_FAILURE on failure.
  2820.  
  2821.  PARAMS    szRegString         - INPUT: Registration string
  2822.            szRegKey            - INPUT: 20-digit registration key string
  2823.            szValidationCode    - INPUT: Application's validation code string
  2824.            szYourName          - INPUT: Your name (if registered)
  2825.            nYourKey            - INPUT: Your key (if registered)
  2826.            peRegistered        - OUTPUT: Is key valid
  2827.  
  2828.  NOTES     Checks whether  a given  registration string and  registration  key
  2829.            combination is  valid  for  a  particular  application,  using  the
  2830.            application-specific  validation   code  that   was  generated   by
  2831.            RegKeyNewCodeSet(). The RKVALID pointed  to by peRegistered is  set
  2832.            to either RK_REGISTERED or  RK_UNREGISTERED, indicating whether  or
  2833.            not the registration key and registration string are valid. If  you
  2834.            have registered RegKey, your own  name and RegKey registration  key
  2835.            should  be  passed   to  this  function   to  disable  the   RegKey
  2836.            "unregistered" message.
  2837.  
  2838.            This function is called from within  your application each time  it
  2839.            executes, in  order  to  determine whether  it  should  operate  in
  2840.            registered or unregistered mode. This  function is used with  user-
  2841.            entered registration keys; compare with RegKeyFileValidate().
  2842.  
  2843.            Concepts of  registration  key  validation are  introduced in  the
  2844.            section which begins on page 34.
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  -----------------------------------------------------------------------------
  2857.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 51
  2858.  
  2859.  
  2860.  -----------------------------------------------------------------------------
  2861.  LANGUAGE  C and C++
  2862.  
  2863.  FUNCTION  RegKeyFileGenerate()
  2864.  
  2865.  PURPOSE   Generates a file-based registration key
  2866.  
  2867.  FORMAT    RKRETURN RegKeyFileGenerate(
  2868.                 const char FAR *szRegString,
  2869.                 const char FAR *szGenerationCode,
  2870.                 const char FAR *szRandomSeed,
  2871.                 const char FAR *szFileName);
  2872.  
  2873.  RETURNS   Type RKRETURN. RK_SUCCESS on success, RK_FAILURE on failure.
  2874.  
  2875.  PARAMS    szRegString         - INPUT: Registration string
  2876.            szGenerationCode    - INPUT: Application's generation code string
  2877.            szRandomSeed        - INPUT: Random number seed string
  2878.            szFileName          - INPUT: Registration key file name
  2879.  
  2880.  NOTES     Generates a  file-based registration  key  for a  particular  user,
  2881.            using the  secret generation  code  corresponding  to  a particular
  2882.            application (as  passed  to RegKeyNewCodeSet()).  The  registration
  2883.            string is usually  the name of  the registered user,  but may  also
  2884.            contain other information, such as  the version registered or  date
  2885.            of expiry. The registration string may be zero to 64K characters in
  2886.            length,  and  is  null-terminated.  A  registration  key  file   is
  2887.            generated,   using   the   specified   filename,   containing   the
  2888.            registration string and the resulting  registration key. If a  file
  2889.            with  the  specified  name  already  exists,  it  is   overwritten.
  2890.            szRandomSeed  should  contain  10  random  numbers  and  upper-case
  2891.            letters, which are required during the registration key  generation
  2892.            process.
  2893.  
  2894.            This function  is called  by KeyGen  or  your own  registration key
  2895.            generation utility, each time a registration key is generated for a
  2896.            new user. This function is  used for file-based registration  keys;
  2897.            compare with RegKeyGenerate().
  2898.  
  2899.            Concepts of  registration  key  generation are introduced  in  the
  2900.            section which begins on page 31.
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  -----------------------------------------------------------------------------
  2913.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 52
  2914.  
  2915.  
  2916.  -----------------------------------------------------------------------------
  2917.  LANGUAGE  C and C++
  2918.  
  2919.  FUNCTION  RegKeyFileValidate()
  2920.  
  2921.  PURPOSE   Checks the validity of a file-based registration key
  2922.  
  2923.  FORMAT    RKRETURN RegKeyFileValidate(
  2924.                 const char FAR *szFileName,
  2925.                 const char FAR *szValidationCode,
  2926.                 const char FAR *szYourName,
  2927.                 unsigned long int nYourKey,
  2928.                 char FAR *szRegString,
  2929.                 unsigned short int cbMaxStringSize,
  2930.                 RKVALID FAR *peRegistered);
  2931.  
  2932.  RETURNS   Type RKRETURN. RK_SUCCESS on success, RK_FAILURE on failure.
  2933.  
  2934.  PARAMS    szFileName          - INPUT: Registration key file name
  2935.            szValidationCode    - INPUT: App's validation code
  2936.            szYourName          - INPUT: Your name (if registered)
  2937.            nYourKey            - INPUT: Your key (if registered)
  2938.            szRegString         - OUTPUT: Registration string
  2939.            cbMaxStringSize     - INPUT: Size of reg. string
  2940.            peRegistered        - OUTPUT: Is key valid
  2941.  
  2942.  NOTES     Checks whether the specified registration key  file is valid for  a
  2943.            particular application, using the application-specified  validation
  2944.            code that was generated by RegKeyNewCodeSet().  The RKVALID pointed
  2945.            to  by   peRegistered   is   set   to   either   RK_REGISTERED   or
  2946.            RK_UNREGISTERED, indicating whether or not the registration key and
  2947.            registration string stored in the registration  key file are valid.
  2948.            The  szFileName  parameter  may  include  wildcards.  If  you  have
  2949.            registered RegKey, your own name and RegKey registration key should
  2950.            be passed to  this function  to disable  the RegKey  "unregistered"
  2951.            message.
  2952.  
  2953.            This function is called from within  your application each time  it
  2954.            executes, in  order  to  determine whether  it  should  operate  in
  2955.            registered or unregistered mode. This  function is used with  file-
  2956.            based registration keys; compare with RegKeyValidate().
  2957.  
  2958.            Concepts of  registration  key  validation are  introduced in  the
  2959.            section which begins on page 34.
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  -----------------------------------------------------------------------------
  2969.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 53
  2970.  
  2971.  
  2972.  USING THE REGKEY SYSTEM WITH QUICKBASIC
  2973.  -----------------------------------------------------------------------------
  2974.  
  2975.            This section describes how to use RegKey with programs written with
  2976.            the Microsoft  QuickBASIC  programming  language.  RegKey has  been
  2977.            tested with Microsoft QuickBASIC  version 4.5. Although no  testing
  2978.            has been done  with other versions,  this information would  likely
  2979.            also apply to  earlier versions  of QuickBASIC.  In addition,  this
  2980.            information may be applicable to using RegKey with Microsoft Visual
  2981.            Basic for  DOS. However,  RegKey has  not been  tested with  Visual
  2982.            Basic for DOS. For  information on using  RegKey with Visual  Basic
  2983.            for Windows, see page 60.
  2984.  
  2985.            There  are  three  files  that   form  the  RegKey  interface   for
  2986.            QuickBASIC. The REGKEYQB.QLB  Quick Library contains  a version  of
  2987.            the RegKey  routines  for  use within  the  QuickBASIC  development
  2988.            environment  (QB.EXE).  In   order  to  use   RegKey  from   within
  2989.            QuickBASIC, you must start up QuickBASIC using the command:
  2990.  
  2991.                 QB \LREGKEYQB.QLB
  2992.  
  2993.            REGKEYQB.LIB   is   a   stand-alone   library   corresponding    to
  2994.            REGKEYQB.QLB,   and  is  automatically   used  by  QuickBASIC  when
  2995.            producing  an  executable   (.EXE)  file  of   your  program.   The
  2996.            REGKEYQB.BI file  provides QuickBASIC  with information  concerning
  2997.            the routines contained in the REGKEYQB.??? library files, and  must
  2998.            be included in any QuickBASIC program that uses RegKey. To do this,
  2999.            the $INCLUDE metacommand is used as follows:
  3000.  
  3001.                 ' $INCLUDE: 'regkeyqb.bi'
  3002.  
  3003.            For an example of  a QuickBASIC program that uses  RegKey, see the
  3004.            DEMOAPPD.BAS program.
  3005.  
  3006.            Below, the calling format for each  of the RegKey API functions  is
  3007.            documented from the perspective of the BASIC programming language:
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  -----------------------------------------------------------------------------
  3025.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 54
  3026.  
  3027.  
  3028.  -----------------------------------------------------------------------------
  3029.  LANGUAGE  QuickBASIC and Visual Basic
  3030.  
  3031.  FUNCTION  RegKeyNewCodeSet()
  3032.  
  3033.  PURPOSE   Creates a new generation / validation code set
  3034.  
  3035.  FORMAT    Result% = RegKeyNewCodeSet%(sGenerationCode$, sValidationCode$)
  3036.  
  3037.  RETURNS   In QuickBASIC: RKSuccess on success, RKFailure on failure.
  3038.            In Visual Basic: 1 on success, 0 on failure.
  3039.  
  3040.  PARAMS    sGenerationCode$    - INPUT: 10-digit generation code string
  3041.            sValidationCode$    - OUTPUT: 10-digit validation code string
  3042.  
  3043.  NOTES     Generates a  registration  key  validation code corresponding  to a
  3044.            generation code. This set  of  generation  and validation  codes is
  3045.            unique for each application using RegKey, and determines the unique
  3046.            registration key that corresponds to a particular user's name.  The
  3047.            secret generation code is used at registration key generation time,
  3048.            and  the  corresponding  validation   code  is  used  within   your
  3049.            application when validating a registration key. The validation  and
  3050.            generation codes are  each represented  as a  ten-digit strings  of
  3051.            numbers and upper-case letters. This  function is called by  KeyGen
  3052.            or your own  utility, and is  only used once  for each  application
  3053.            using RegKey.
  3054.  
  3055.            The concepts of  code set creation are  introduced in  the section
  3056.            which begins on page 29.
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  -----------------------------------------------------------------------------
  3081.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 55
  3082.  
  3083.  
  3084.  -----------------------------------------------------------------------------
  3085.  LANGUAGE  QuickBASIC and Visual Basic
  3086.  
  3087.  FUNCTION  RegKeyGenerate()
  3088.  
  3089.  PURPOSE   Creates a user-entered type registration key
  3090.  
  3091.  FORMAT    Result% = RegKeyGenerate%(sRegString$, sGenerationCode$,
  3092.            sRandomSeed$, sRegKey$)
  3093.  
  3094.  RETURNS   In QuickBASIC: RKSuccess on success, RKFailure on failure.
  3095.            In Visual Basic: 1 on success, 0 on failure.
  3096.  
  3097.  PARAMS    sRegString$         - INPUT: Registration string
  3098.            sGenerationCode$    - INPUT: Application's generation code string
  3099.            sRandomSeed$        - INPUT: Random number seed string
  3100.            sRegKey$            - OUTPUT: 20-digit registration key string
  3101.  
  3102.  NOTES     Generates a  registration  key for  a  particular user,  using  the
  3103.            secret generation code  corresponding to  a particular  application
  3104.            (as passed  to  RegKeyNewCodeSet()).  The  registration  string  is
  3105.            usually the name of the registered user, but may also contain other
  3106.            information, such as the version registered or date of expiry.  The
  3107.            registration string may be  zero to 64K  characters in length.  The
  3108.            registration key is returned as a string of letters and  upper-case
  3109.            letters. sRandomSeed$ should contain  10 random numbers and  upper-
  3110.            case numbers,  which  are  required  during  the  registration  key
  3111.            generation process.
  3112.  
  3113.            This function  is called  by  KeyGen or  your own  registration key
  3114.            generation utility, each time a registration key is generated for a
  3115.            new user. This function is used for user-entered registration keys;
  3116.            compare with RegKeyFileGenerate().
  3117.  
  3118.            Concepts of  registration  key  generation are  introduced  in  the
  3119.            section which begins on page 31.
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  -----------------------------------------------------------------------------
  3137.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 56
  3138.  
  3139.  
  3140.  -----------------------------------------------------------------------------
  3141.  LANGUAGE  QuickBASIC and Visual Basic
  3142.  
  3143.  FUNCTION  RegKeyValidate()
  3144.  
  3145.  PURPOSE   Checks the validity of a user-entered registration key
  3146.  
  3147.  FORMAT    Result% = RegKeyValidate%(sRegString$, sRegKey$, sValidationCode$,
  3148.            sYourName$, nYourKey AS LONG, peRegistered AS INTEGER)
  3149.  
  3150.  RETURNS   In QuickBASIC: RKSuccess on success, RKFailure on failure.
  3151.            In Visual Basic: 1 on success, 0 on failure.
  3152.  
  3153.  PARAMS    sRegString$         - INPUT: Registration string
  3154.            sRegKey$            - INPUT: 20-digit registration key
  3155.            sValidationCode$    - INPUT: Application's validation code
  3156.            sYourName$          - INPUT: Your name (if registered)
  3157.            nYourKey&           - INPUT: Your key (if registered)
  3158.            peRegistered%       - OUTPUT: Is key valid
  3159.  
  3160.  NOTES     Checks whether  a given  registration  string and  registration key
  3161.            combination is  valid  for  a  particular  application,  using  the
  3162.            application-specific  validation   code  that   was  generated   by
  3163.            RegKeyNewCodeSet(). The integer passed as peRegistered is set to  0
  3164.            (or RKUnregistered in  QuickBASIC) if the  registration key is  not
  3165.            valid, and  is set  to 1  (or RKRegistered  in QuickBASIC)  if  the
  3166.            registration key is valid. If you have registered RegKey, your  own
  3167.            name and RegKey registration key should be passed to this  function
  3168.            to disable the RegKey "unregistered" message.
  3169.  
  3170.            This function is called from within  your application each time it
  3171.            executes, in  order  to  determine whether  it  should  operate  in
  3172.            registered or unregistered mode. This  function is used with  user-
  3173.            entered registration keys; compare with RegKeyFileValidate().
  3174.  
  3175.            Concepts of  registration  key  validation are  introduced  in  the
  3176.            section which begins on page 34.
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  -----------------------------------------------------------------------------
  3193.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 57
  3194.  
  3195.  
  3196.  -----------------------------------------------------------------------------
  3197.  LANGUAGE  QuickBASIC and Visual Basic
  3198.  
  3199.  FUNCTION  RegKeyFileGenerate()
  3200.  
  3201.  PURPOSE   Generates a file-based registration key
  3202.  
  3203.  FORMAT    Result% = RegKeyFileGenerate%(sRegString$, sGenerationCode$,
  3204.            sRandomSeed$, sFileName$)
  3205.  
  3206.  RETURNS   In QuickBASIC: RKSuccess on success, RKFailure on failure.
  3207.            In Visual Basic: 1 on success, 0 on failure.
  3208.  
  3209.  PARAMS    sRegString$         - INPUT: Registration string
  3210.            sGenerationCode$    - INPUT: Application's generation code string
  3211.            sRandomSeed$        - INPUT: Random number seed string
  3212.            sFileName$          - INPUT: Registration key file name string
  3213.  
  3214.  NOTES     Generates a  file-based  registration  key  for a  particular  user,
  3215.            using the  secret generation   code corresponding  to  a particular
  3216.            application (as  passed  to RegKeyNewCodeSet()).  The  registration
  3217.            string is usually  the name of  the registered user,  but may  also
  3218.            contain other information, such as  the version registered or  date
  3219.            of  expiry.  A  registration  key  file  is  generated,  using  the
  3220.            specified filename,  containing  the registration  string  and  the
  3221.            resulting registration  key.  If a  file  with the  specified  name
  3222.            already exists, it is  overwritten. sRandomSeed$ should contain  10
  3223.            random numbers and  upper-case letters, which  are required  during
  3224.            the registration key generation process.
  3225.  
  3226.            This function  is called  by KeyGen or  your  own  registration key
  3227.            generation utility, each time a registration key is generated for a
  3228.            new user. This function is  used for file-based registration  keys;
  3229.            compare with RegKeyGenerate().
  3230.  
  3231.            Concepts of  registration  key  generation are  introduced  in  the
  3232.            section which begins on page 31.
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  -----------------------------------------------------------------------------
  3249.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 58
  3250.  
  3251.  
  3252.  -----------------------------------------------------------------------------
  3253.  LANGUAGE  QuickBASIC and Visual Basic
  3254.  
  3255.  FUNCTION  RegKeyFileValidate()
  3256.  
  3257.  PURPOSE   Checks the validity of a file-based registration key
  3258.  
  3259.  FORMAT    Result% = RegKeyFileValidate%(sFileName$, sValidationCode$,
  3260.            sYourName$, nYourKey AS LONG, sRegString$, cbMaxStringSize AS
  3261.            INTEGER, peRegistered AS INTEGER)
  3262.  
  3263.  RETURNS   In QuickBASIC: RKSuccess on success, RKFailure on failure.
  3264.            In Visual Basic: 1 on success, 0 on failure.
  3265.  
  3266.  PARAMS    sFileName$          - INPUT: Registration key file name string
  3267.            sValidationCode$    - INPUT: App's validation code string
  3268.            sYourName$          - INPUT: Your name (if registered)
  3269.            nYourKey            - INPUT: Your key (if registered)
  3270.            sRegString$         - OUTPUT: Registration string
  3271.            cbMaxStringSize%    - INPUT: Maximum size of registration string
  3272.            peRegistered&       - OUTPUT: Is key valid
  3273.  
  3274.  NOTES     Checks whether the specified registration key  file is valid for  a
  3275.            particular application, using the application-specified  validation
  3276.            code that was generated  by RegKeyNewCodeSet().  The integer passed
  3277.            as peRegistered  is set  to 0 (or  RKUnregistered in QuickBASIC) if
  3278.            the registration key is not valid, and is set to 1 (or RKRegistered
  3279.            in QuickBASIC) if  the registration  key is  valid. The  szFileName
  3280.            parameter may  include wildcards.  If you  have registered  RegKey,
  3281.            your own name and RegKey registration key should be passed to  this
  3282.            function to disable the RegKey "unregistered" message.
  3283.  
  3284.            The integer  cbMaxString  size  indicates  the  maximum  number  if
  3285.            characters that should  be placed in  the sRegString$ string.  With
  3286.            QuickBASIC, this may be any value from 1 to 255. With Visual Basic,
  3287.            this may be any value from 1 to 30,000.
  3288.  
  3289.            This function is called from within  your application each time  it
  3290.            executes, in  order  to  determine whether  it  should  operate  in
  3291.            registered or unregistered mode. This  function is used with  file-
  3292.            based registration keys; compare with RegKeyValidate().
  3293.  
  3294.            Concepts of  registration  key  validation are  introduced  in  the
  3295.            section which begins on page 34.
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  -----------------------------------------------------------------------------
  3305.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 59
  3306.  
  3307.  
  3308.  USING THE REGKEY SYSTEM WITH VISUAL BASIC
  3309.  -----------------------------------------------------------------------------
  3310.  
  3311.            This section describes how to use  RegKey in programs written  with
  3312.            Microsoft Visual Basic for Windows. For information on using RegKey
  3313.            with Visual Basic for DOS, see page 54. RegKey has been tested with
  3314.            version 2.0 of  Visual Basic for  Windows. This information  should
  3315.            also apply to version 1.0 and 3.0 of the Visual Basic system.
  3316.  
  3317.            The RegKey interface for Visual  Basic consists of two  components:
  3318.            the REGKEYVB.BAS  module  that you  include  in your  Visual  Basic
  3319.            project, and  the  RK30VB.DLL file  that  is used  to  generate  or
  3320.            validate registration  keys  during your  program's  execution.  To
  3321.            include REGKEYVB.BAS in your  program, choose the File|Add  File...
  3322.            option from within Visual Basic,  and then select the  REGKEYVB.BAS
  3323.            file. The REGKEYVB.BAS  module will  now appear  in your  program's
  3324.            project window within Visual Basic. You should not normally  change
  3325.            the contents  of  this file,  but  feel free  to  refer to  it  for
  3326.            reference to the  RegKey functions.  The role  of the  REGKEYVB.BAS
  3327.            module is to serve as a intermediate layer between your program and
  3328.            the RK30VB.DLL library, ensuring that strings passed to  RK30VB.DLL
  3329.            are large enough for it to return any necessary information to you.
  3330.  
  3331.            The RK30VB.DLL file must be present in the Windows system directory
  3332.            (typically C:\WINDOWS\SYSTEM)  whenever your  program is  run,  and
  3333.            should be distributed with your program. You may wish to provide an
  3334.            installation utility for  your software,  which will  automatically
  3335.            install the RK30VB.DLL file in the user's Windows system directory.
  3336.  
  3337.            For an example of a Visual Basic program that uses RegKey,  see the
  3338.            DemoAppW source  code  contained  in  the  files  DEMOAPPW.BAS  and
  3339.            DEMOAPPW.MAK.
  3340.  
  3341.            The calling  format  for  each  of  the  RegKey  API  functions  is
  3342.            documented from the perspective  of the BASIC programming  language
  3343.            beginning on page 55.
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  -----------------------------------------------------------------------------
  3361.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 60
  3362.  
  3363.  
  3364.  USING THE REGKEY SYSTEM WITH TURBO PASCAL
  3365.  -----------------------------------------------------------------------------
  3366.  
  3367.            This section describes how to use  RegKey in programs written  with
  3368.            Turbo Pascal. If you have not already extracted the contents of the
  3369.            TP.ZIP file included in your RegKey package, you should do so now.
  3370.  
  3371.            The RegKey package  includes a .TPU  unit that  is compatible  with
  3372.            Turbo Pascal for DOS 7.0.  If you  are using a different version of
  3373.            Turbo Pascal, you  will have to  follow the  instructions below  to
  3374.            build a RegKey unit  for your version of  Turbo Pascal. If you  are
  3375.            using Turbo  Pascal 7.0,  simply rename  the included  REGKEYD7.TPU
  3376.            file to REGKEYD.TPU. You can  then skip the following  instructions
  3377.            for building a RegKey unit.
  3378.  
  3379.            (Please Note  - while  the necessary  files for  using RegKey  with
  3380.            Turbo Pascal for Windows have  been included in the RegKey package,
  3381.            RegKey has not been tested with Turbo Pascal for Windows.)
  3382.  
  3383.            If you  are  using  any version  of Turbo  Pascal other  than Turbo
  3384.            Pascal for DOS 7.0, you  will have to first  build a .TPU unit  for
  3385.            your version of Turbo Pascal. In order to do this, you will need to
  3386.            have the following file (included in the RegKey package) located in
  3387.            the current directory or your Turbo Pascal working directory:
  3388.  
  3389.            FOR DOS:       REGKEYD.PAS
  3390.                           RKFGEND.OBJ
  3391.                           RKFILED.OBJ
  3392.                           RKFVALD.OBJ
  3393.                           RKGEND.OBJ
  3394.                           RKMATHD.OBJ
  3395.                           RKNSETD.OBJ
  3396.                           RKRD.OBJ
  3397.                           RKTPD.OBJ
  3398.                           RKVALD.OBJ
  3399.  
  3400.            For Windows:   REGKEYW.PAS
  3401.                           RKFGENW.OBJ
  3402.                           RKFILEW.OBJ
  3403.                           RKFVALW.OBJ
  3404.                           RKGENW.OBJ
  3405.                           RKMATHW.OBJ
  3406.                           RKNSETW.OBJ
  3407.                           RKRW.OBJ
  3408.                           RKTPW.OBJ
  3409.                           RKVALW.OBJ
  3410.  
  3411.            You can either  build the RegKey  unit for the  DOS command  prompt
  3412.            using the  TPC  compiler,  or from  within  the  TURBO  development
  3413.            environment. From the command line,  type TPC REGKEYD.PAS to  build
  3414.            the  REGKEYD.TPU   unit.   From  within   the   TURBO   development
  3415.  
  3416.  -----------------------------------------------------------------------------
  3417.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 61
  3418.  
  3419.  
  3420.            environment, open  the  REGKEYD.PAS source  file  for DOS,  or  the
  3421.            REGKEYW.PAS source file for Windows.  From the Compile menu  choose
  3422.            File as a destination, and then choose the "Make" command.
  3423.  
  3424.            Once you have built a .TPU  unit for your version of Turbo  Pascal,
  3425.            you can either  place it in  the same directory  as your  program's
  3426.            .PAS source code  files, or you  can place it  in the Turbo  Pascal
  3427.            UNITS directory.
  3428.  
  3429.            To call any  of the  RegKey functions  from within  a Turbo  Pascal
  3430.            program, you must place a uses clause at the start of your program,
  3431.            and include RegKeyD (for DOS) or RegKeyW (for Windows) in the  list
  3432.            of units. For example:
  3433.  
  3434.                 program TestAppD;
  3435.                 uses RegKeyD, Graph;
  3436.  
  3437.            For an example of  a Turbo Pascal program that uses RegKey, see the
  3438.            DEMOAPPD.PAS program that is included in your RegKey package.
  3439.  
  3440.            Below, the calling format for each  of the RegKey API functions  is
  3441.            documented from the perspective of the BASIC programming language:
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  -----------------------------------------------------------------------------
  3473.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 62
  3474.  
  3475.  
  3476.  -----------------------------------------------------------------------------
  3477.  LANGUAGE  Turbo Pascal
  3478.  
  3479.  FUNCTION  RegKeyNewCodeSet()
  3480.  
  3481.  PURPOSE   Creates a new generation / validation code set
  3482.  
  3483.  FORMAT    function RegKeyNewCodeSet(
  3484.                  sGenerationCode : string;
  3485.                  sValidationCode : string)
  3486.               : RKReturn;
  3487.  
  3488.  RETURNS   Enumeration type RKReturn. Value of RKSuccess on success, RKFailure
  3489.            on failure.
  3490.  
  3491.  PARAMS    sGenerationCode     - INPUT: 10-digit generation code string
  3492.            sValidationCode     - OUTPUT: 10-digit validation code string
  3493.  
  3494.  NOTES     Generates a  registration  key  validation code corresponding  to a
  3495.            generation code.  This set  of generation  and validation  codes is
  3496.            unique for each application using RegKey, and determines the unique
  3497.            registration key that corresponds to a particular user's name.  The
  3498.            secret generation code is used at registration key generation time,
  3499.            and  the  corresponding  validation   code  is  used  within   your
  3500.            application when validating a registration key. The validation  and
  3501.            generation codes are  each represented  as a  ten-digit strings  of
  3502.            numbers and upper-case letters. This  function is called by  KeyGen
  3503.            or your own  utility, and is  only used once  for each  application
  3504.            using RegKey.
  3505.  
  3506.            The concepts of  code set  creation are  introduced in  the section
  3507.            which begins on page 29.
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  -----------------------------------------------------------------------------
  3529.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 63
  3530.  
  3531.  
  3532.  -----------------------------------------------------------------------------
  3533.  LANGUAGE  Turbo Pascal
  3534.  
  3535.  FUNCTION  RegKeyGenerate()
  3536.  
  3537.  PURPOSE   Creates a user-entered type registration key
  3538.  
  3539.  FORMAT    function RegKeyGenerate(
  3540.                  sRegString      : string;
  3541.                  sGenerationCode : string;
  3542.                  sRandomSeed     : string;
  3543.                  sRegKey         : string)
  3544.               : RKReturn;
  3545.  
  3546.  RETURNS   Enumeration type RKReturn. Value of RKSuccess on success, RKFailure
  3547.            on failure.
  3548.  
  3549.  PARAMS    sRegString          - INPUT: Registration string
  3550.            sGenerationCode     - INPUT: Application's generation code string
  3551.            sRandomSeed         - INPUT: Random number seed string
  3552.            sRegKey             - OUTPUT: 20-digit registration key string
  3553.  
  3554.  NOTES     Generates a  registration  key for  a  particular user,  using  the
  3555.            secret generation code corresponding to  a  particular  application
  3556.            (as  passed  to  RegKeyNewCodeSet()). The  registration  string  is
  3557.            usually the name of the registered user, but may also contain other
  3558.            information, such as the version registered or date of expiry.  The
  3559.            registration key is returned in sRegKey as a string of letters  and
  3560.            upper-case letters. The string passed in sRegKey should be at least
  3561.            20 characters in size. sRandomSeed should contain 10 random numbers
  3562.            and upper-case numbers, which are required during the  registration
  3563.            key generation process.
  3564.  
  3565.            This function  is called  by KeyGen or  your own  registration  key
  3566.            generation utility, each time a registration key is generated for a
  3567.            new user. This function is used for user-entered registration keys;
  3568.            compare with RegKeyFileGenerate().
  3569.  
  3570.            Concepts of  registration  key  generation are  introduced  in  the
  3571.            section which begins on page 31.
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  -----------------------------------------------------------------------------
  3585.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 64
  3586.  
  3587.  
  3588.  -----------------------------------------------------------------------------
  3589.  LANGUAGE  Turbo Pascal
  3590.  
  3591.  FUNCTION  RegKeyValidate()
  3592.  
  3593.  PURPOSE   Checks the validity of a user-entered registration key
  3594.  
  3595.  FORMAT    function RegKeyValidate(
  3596.                  sRegString       : string;
  3597.                  sRegKey          : string;
  3598.                  sValidationCode  : string;
  3599.                  sYourName        : string;
  3600.                  nYourKey         : longint;
  3601.                  var peRegistered : RKValid)
  3602.               : RKReturn;
  3603.  
  3604.  RETURNS   Enumeration type RKReturn. Value of RKSuccess on success, RKFailure
  3605.            on failure.
  3606.  
  3607.  PARAMS    sRegString          - INPUT: Registration string
  3608.            sRegKey             - INPUT: 20-digit registration key
  3609.            sValidationCode     - INPUT: Application's validation code
  3610.            sYourName           - INPUT: Your name (if registered)
  3611.            nYourKey            - INPUT: Your key (if registered)
  3612.            peRegistered        - OUTPUT: Is key valid
  3613.  
  3614.  NOTES     Checks whether  a given  registration string  and  registration key
  3615.            combination is  valid  for  a  particular  application,  using  the
  3616.            application-specific  validation   code  that   was  generated   by
  3617.            RegKeyNewCodeSet(). The parameter peRegistered should be a variable
  3618.            of type RKValid. This variable is set to the value RKRegistered  if
  3619.            the registration  key is  valid, and  RKUnregistered if  it is  not
  3620.            valid. If  you have  registered RegKey,  your own  name and  RegKey
  3621.            registration key should be passed to  this function to disable  the
  3622.            RegKey "unregistered" message.
  3623.  
  3624.            This function is called from within  your application each time  it
  3625.            executes, in  order  to  determine whether  it  should  operate  in
  3626.            registered or unregistered mode. This  function is used with  user-
  3627.            entered registration keys; compare with RegKeyFileValidate().
  3628.  
  3629.            Concepts of  registration  key  validation are  introduced  in  the
  3630.            section which begins on page 34.
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  -----------------------------------------------------------------------------
  3641.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 65
  3642.  
  3643.  
  3644.  -----------------------------------------------------------------------------
  3645.  LANGUAGE  Turbo Pascal
  3646.  
  3647.  FUNCTION  RegKeyFileGenerate()
  3648.  
  3649.  PURPOSE   Generates a file-based registration key
  3650.  
  3651.  FORMAT    function RegKeyFileGenerate(
  3652.                  sRegString      : string;
  3653.                  sGenerationCode : string;
  3654.                  sRandomSeed     : string;
  3655.                  sFileName       : string)
  3656.               : RKReturn;
  3657.  
  3658.  RETURNS   Enumeration type RKReturn. Value of RKSuccess on success, RKFailure
  3659.            on failure.
  3660.  
  3661.  PARAMS    sRegString          - INPUT: Registration string
  3662.            sGenerationCode     - INPUT: Application's generation code string
  3663.            sRandomSeed         - INPUT: Random number seed string
  3664.            sFileName           - INPUT: Registration key file name string
  3665.  
  3666.  NOTES     Generates a  file-based registration  key  for  a  particular  user,
  3667.            using the  secret generation  code  corresponding  to  a particular
  3668.            application (as  passed  to RegKeyNewCodeSet()).  The  registration
  3669.            string is usually  the name of  the registered user,  but may  also
  3670.            contain other information, such as  the version registered or  date
  3671.            of  expiry.  A  registration  key  file  is  generated,  using  the
  3672.            specified filename,  containing  the registration  string  and  the
  3673.            resulting registration  key.  If a  file  with the  specified  name
  3674.            already exists, it  is overwritten. sRandomSeed  should contain  10
  3675.            random numbers and  upper-case letters, which  are required  during
  3676.            the registration key generation process.
  3677.  
  3678.            This function  is called  by KeyGen or  your  own  registration key
  3679.            generation utility, each time a registration key is generated for a
  3680.            new user. This function is  used for file-based registration  keys;
  3681.            compare with RegKeyGenerate().
  3682.  
  3683.            Concepts of  registration  key  generation are  introduced  in  the
  3684.            section which begins on page 31.
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  -----------------------------------------------------------------------------
  3697.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 66
  3698.  
  3699.  
  3700.  -----------------------------------------------------------------------------
  3701.  LANGUAGE  Turbo Pascal
  3702.  
  3703.  FUNCTION  RegKeyFileValidate()
  3704.  
  3705.  PURPOSE   Checks the validity of a file-based registration key
  3706.  
  3707.  FORMAT    function RegKeyFileValidate(
  3708.                  sFileName        : string;
  3709.                  sValidationCode  : string;
  3710.                  sYourName        : string;
  3711.                  nYourKey         : longint;
  3712.                  sRegString       : string;
  3713.                  cbMaxStringSize  : byte;
  3714.                  var peRegistered : RKValid)
  3715.               : RKReturn;
  3716.  
  3717.  RETURNS   Enumeration type RKReturn. Value of RKSuccess on success, RKFailure
  3718.            on failure.
  3719.  
  3720.  PARAMS    sFileName           - INPUT: Registration key file name string
  3721.            sValidationCode     - INPUT: App's validation code string
  3722.            sYourName           - INPUT: Your name (if registered)
  3723.            nYourKey            - INPUT: Your key (if registered)
  3724.            sRegString          - OUTPUT: Registration string
  3725.            cbMaxStringSize     - INPUT: Maximum size of registration string
  3726.            peRegistered        - OUTPUT: Is key valid
  3727.  
  3728.  NOTES     Checks whether the specified registration key  file is valid for  a
  3729.            particular application, using the application-specified  validation
  3730.            code  that  was  generated  by  RegKeyNewCodeSet().  The  parameter
  3731.            peRegistered should be a variable of type RKValid. This variable is
  3732.            set to the value RKRegistered if the registration key is valid, and
  3733.            RKUnregistered if it is not valid.  If you have registered  RegKey,
  3734.            your own name and RegKey registration key should be passed to  this
  3735.            function to disable the RegKey "unregistered" message.
  3736.  
  3737.            The integer  cbMaxString  size  indicates  the  maximum  number  if
  3738.            characters that  should be  placed in  the sRegString  string,  and
  3739.            should be equal  to the size  of the passed  string as declared  in
  3740.            Turbo Pascal, or 255 if  no size was specified  when declaring the
  3741.            string.
  3742.  
  3743.            This function is called from within  your application each time  it
  3744.            executes, in  order  to  determine whether  it  should  operate  in
  3745.            registered or unregistered mode. This  function is used with  file-
  3746.            based registration keys; compare with RegKeyValidate().
  3747.  
  3748.            Concepts of  registration  key  validation are  introduced  in  the
  3749.            section which begins on page 34.
  3750.  
  3751.  
  3752.  -----------------------------------------------------------------------------
  3753.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 67
  3754.  
  3755.  
  3756.  USING REGKEY WITH OTHER LANGUAGES OR OPERATING SYSTEMS
  3757.  -----------------------------------------------------------------------------
  3758.  
  3759.            If you  are  working  with  a  programming  language,  compiler  or
  3760.            operating system that  is not specifically  addressed in the  above
  3761.            sections, it may still be possible for you to use RegKey. There are
  3762.            three possible options:
  3763.  
  3764.           A.) Calling routines from the included RegKey library files
  3765.           B.) Obtaining the RegKey source code and porting it
  3766.           C.) Obtaining a custom version of RegKey from me
  3767.  
  3768.            Each of these options are described in more detail below:
  3769.  
  3770.           A.) Many PC-based  programming languages have  the ability to  call
  3771.               functions using the C calling conventions, from Intel/Microsoft
  3772.               object format library files. For information on how to  do this
  3773.               in the language you  are using, see  the documentation that  is
  3774.               included with your language.  This documentation will  probably
  3775.               refer to  the  function  names and  parameters  (known  as  the
  3776.               function prototype) of the  C language functions to  be called.
  3777.               The pertinent information on  the C functions that  form RegKey
  3778.               is described in the section beginning on page 46.
  3779.  
  3780.           B.) As  is  described  on  page  13,  the  RegKey  source  code  is
  3781.               available.  RegKey  is  written  in  ANSI-compliant  C  and  is
  3782.               designed to be  easily ported  to other  hardware platforms  or
  3783.               operating systems. While the  source code package does  include
  3784.               80x86 assembly language routines  for performing certain  tasks
  3785.               such as 96-bit  arithmetic, the  equivalent C  source code  for
  3786.               these routines is also included.
  3787.  
  3788.           C.) I may  also be  willing to  port  RegKey to  another  operating
  3789.               system, hardware platform or  programming language for you.  To
  3790.               do this, I usually require  that you (LEGALLY) furnish  me with
  3791.               the necessary  software  and/or  hardware to  create  a  custom
  3792.               version of RegKey. If I am able to keep the software / hardware
  3793.               and use it to produce future  versions of RegKey for  others, I
  3794.               would generally provide you with a free RegKey registration and
  3795.               copy of the source  code, but no more.  If you wish to  discuss
  3796.               this possibility further, please feel free to get in touch with
  3797.               me. For more information how to reach me, see page 69.
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  -----------------------------------------------------------------------------
  3809.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 68
  3810.  
  3811.  
  3812.  -----------------------------------------------------------------------------
  3813.  PART 5: ADDITIONAL INFORMATION
  3814.  -----------------------------------------------------------------------------
  3815.  
  3816.  
  3817.  
  3818.  GETTING HELP
  3819.  -----------------------------------------------------------------------------
  3820.  
  3821.            If you have  any questions  about RegKey,  would like  help with  a
  3822.            program that your are writing, or  have any suggestions for  future
  3823.            versions of RegKey, please feel free to get in touch with me.
  3824.  
  3825.            If you  are  having difficulties  with  RegKey, the  more  detailed
  3826.            information you supply (such as source code to the program that  is
  3827.            causing the problem, how to duplicate the problem, etc.), the  more
  3828.            quickly I will be able to determine the cause of your problem.
  3829.  
  3830.            If you would like  to receive the most  recent copy of RegKey,  you
  3831.            can download  it  from the  RegKey  support bulletin  board  system
  3832.            (phone number  below), file  request it  from the  FidoNet  address
  3833.            below, or send three dollars ($3) to cover the cost of postage  and
  3834.            a diskette to the address listed below.
  3835.  
  3836.            You can get in touch with me by any of the following means:
  3837.  
  3838.           -  By conventional mail. My postal address is:
  3839.  
  3840.                           Brian Pirie
  3841.                           Apt. 1416 - 2201 Riverside Dr.
  3842.                           Ottawa, Ontario
  3843.                           K1H 8K9
  3844.                           Canada
  3845.  
  3846.           -  By electronic mail. My Internet e-mail address is:
  3847.  
  3848.                           brian@bpecomm.ocunix.on.ca
  3849.  
  3850.              And my FidoNet netmail address is:
  3851.  
  3852.                           1:243/8   ***SEE NOTE BELOW***
  3853.  
  3854.              If you  have access  to an  on-line service  such as  Prodigy or
  3855.              CompuServe, you can also reach me by sending Internet e-mail.
  3856.  
  3857.              While I would  like to be able  to reply to  all FidoNet NetMail
  3858.              messages by CrashMail, I am afraid I can not  afford to do this.
  3859.              So, if you choose  to send NetMail, please  indicate whether you
  3860.              would like me to reply by routed NetMail (this  may not work, if
  3861.              routed NetMail is not available  in your area), or  to place the
  3862.              message on hold for you to poll and pick up.
  3863.  
  3864.  -----------------------------------------------------------------------------
  3865.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 69
  3866.  
  3867.  
  3868.  
  3869.           -  By calling the RegKey  support bulletin board system.  The phone
  3870.              number for the support BBS is:
  3871.  
  3872.                           +1 613 526 4466
  3873.  
  3874.              The  BBS  supports  speeds  up  to  9600bps,  with  v.32/v.42bis
  3875.              capabilities. You are  given full access  to the support  BBS on
  3876.              your first call. In addition  to being able to  reach me through
  3877.              the support BBS,  you can  also download  the newest  version of
  3878.              RegKey, and other  software that  may be  of interest  to people
  3879.              using RegKey.
  3880.  
  3881.            I try to respond to all correspondences as soon as possible  (i.e.,
  3882.            within twenty-four hours). However, it is possible that it may take
  3883.            longer to reply to your message,  particularly if you are asking  a
  3884.            question that requires time for me to get an answer, or if I happen
  3885.            to be away for a few days.
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.  
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  -----------------------------------------------------------------------------
  3921.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 70
  3922.  
  3923.  
  3924.  CONTENTS OF PACKAGE
  3925.  -----------------------------------------------------------------------------
  3926.  
  3927.            The disk / archive  in which you received  your copy of the  RegKey
  3928.            package should include the following files:
  3929.  
  3930.            FILE_ID.DIZ         A brief description of RegKey
  3931.  
  3932.            C_CPP.ZIP           Contains C/C++ language specific files
  3933.                REGKEYSD.LIB    DOS tiny/small memory model RegKey library
  3934.                REGKEYCD.LIB    DOS compact memory model RegKey library
  3935.                REGKEYMD.LIB    DOS medium memory model RegKey library
  3936.                REGKEYLD.LIB    DOS large/huge memory model RegKey library
  3937.                REGKEYSW.LIB    Windows small memory model RegKey library
  3938.                REGKEYCW.LIB    Windows compact memory model RegKey library
  3939.                REGKEYMW.LIB    Windows medium memory model RegKey library
  3940.                REGKEYLW.LIB    Windows large/huge memory model RegKey library
  3941.                REGKEY.H        C/C++ include file for RegKey
  3942.                DEMOAPPD.C      C language DOS version of example program
  3943.                DEMOAPPW.C      C language Windows version of example program
  3944.                DEMOAPPD.CPP    C++ language DOS version of example program
  3945.                DEMOAPPW.CPP    C++ language Windows version of example program
  3946.  
  3947.            TP.ZIP              Contains Turbo Pascal specific files
  3948.                REGKEYD.PAS     Pascal file for building RegKey TP/DOS unit
  3949.                RKFGEND.OBJ     Object files for building RegKey TP/DOS unit
  3950.                RKFILED.OBJ             "                             "
  3951.                RKFVALD.OBJ             "                             "
  3952.                RKGEND.OBJ              "                             "
  3953.                RKMATHD.OBJ             "                             "
  3954.                RKNSETD.OBJ             "                             "
  3955.                RKRD.OBJ                "                             "
  3956.                RKTPD.OBJ               "                             "
  3957.                RKVALD.OBJ              "                             "
  3958.                REGKEYD.PAS     Pascal file for building RegKey TP/Windows unit
  3959.                RKFGEND.OBJ     Object files for building TP/Windows unit
  3960.                RKFILED.OBJ             "                       "
  3961.                RKFVALD.OBJ             "                       "
  3962.                RKGEND.OBJ              "                       "
  3963.                RKMATHD.OBJ             "                       "
  3964.                RKNSETD.OBJ             "                       "
  3965.                RKRD.OBJ                "                       "
  3966.                RKTPD.OBJ               "                       "
  3967.                RKVALD.OBJ              "                       "
  3968.                REGKEYD7.TPU    RegKey Unit for Turbo Pascal 7.0 for DOS
  3969.                DEMOAPPD.PAS    Pascal source code for RegKey example program
  3970.  
  3971.            QB.ZIP              Contains QuickBASIC specific files
  3972.                REGKEYQB.QLB    QuickBASIC Quick Library for RegKey
  3973.                REGKEYQB.LIB    QuickBASIC stand-alone library for RegKey
  3974.                REGKEYQB.BI     QuickBASIC include file for RegKey
  3975.  
  3976.  -----------------------------------------------------------------------------
  3977.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 71
  3978.  
  3979.  
  3980.                DEMOAPPD.BAS    QuickBASIC version of the example program
  3981.  
  3982.            VB.ZIP              Contains Visual Basic specific files
  3983.                RK30VB.DLL      RegKey .DLL callable from Visual Basic
  3984.                REGKEYVB.BAS    RegKey interface module for Visual Basic
  3985.                DEMOAPPW.BAS    Visual Basic version of the example program
  3986.                DEMOAPPW.MAK    Visual Basic project file for example program
  3987.  
  3988.            KEYGEN.DAT          Data file used by key generation utility
  3989.            KEYGEND.EXE         DOS version of key generation utility
  3990.            KEYGENW.EXE         Windows version of key generation utility
  3991.            CTL3DV2.DLL         Used by Windows version of KeyGen
  3992.  
  3993.            DEMOAPPD.EXE        DOS version of the RegKey example program
  3994.            DEMOAPPW.EXE        Windows version of the RegKey example program
  3995.  
  3996.            ORDER.FRM           Easy to print RegKey order form
  3997.            REGKEY.TXT          The RegKey programmer's manual (this file).
  3998.  
  3999.            If you received your copy of RegKey on a diskette, that disk should
  4000.            also contain the utility PKUNZIP.EXE, which is used to extract  the
  4001.            contents of the *.ZIP files. If you do not have this utility, or if
  4002.            you are missing any  of the other RegKey  files, please contact  me
  4003.            for a current copy of RegKey.
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  -----------------------------------------------------------------------------
  4033.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 72
  4034.  
  4035.  
  4036.  GLOSSARY
  4037.  -----------------------------------------------------------------------------
  4038.  
  4039.            API
  4040.  
  4041.            API  is  an   acronym  for  "Application   Program  Interface"   or
  4042.            "Application Programmer Interface". An API is a well-defined set of
  4043.            related  functions  or  procedures  that  can  be  called  from  an
  4044.            application program written  in a programming  language such as  C,
  4045.            C++, Pascal or BASIC. These functions are used to access a specific
  4046.            feature or set of features from within your program. The RegKey API
  4047.            consists of five  functions (RegKeyNewCodeSet(), RegKeyGenerate (),
  4048.            RegKeyValidate(),  RegKeyFileGenerate()  and  RegKeyFileValidate())
  4049.            which you  can use  to add  registration key  capabilities to  your
  4050.            programs. Another example of an APIs is the Microsoft Windows  API,
  4051.            which provide  Windows  programs  with access  to  screen  display,
  4052.            printing and other features which are managed by Windows.
  4053.  
  4054.  
  4055.  
  4056.            BRAND
  4057.  
  4058.            As an  alternative  to using  registration  keys, each  copy  of  a
  4059.            particular application can  be "branded" with  a particular  user's
  4060.            name. In this case,  the application's executable file(s)  contains
  4061.            the name of the one user  who is licensed to  use that copy of  the
  4062.            software, and that  name is usually  displayed at program  startup.
  4063.            Branding is  commonly used  in  commercial software  to  discourage
  4064.            illegal copying of  the software, as  the guilty  user's name  will
  4065.            appear on every illegal copy. This disadvantage of this approach is
  4066.            that it  requires the  author or  company selling  the software  to
  4067.            produce a unique copy of the program for each user.
  4068.  
  4069.  
  4070.  
  4071.            CODE SET
  4072.  
  4073.            RegKey uses the term "code  set" to  refer  to a  set consisting of
  4074.            "generation code" and a corresponding  "validation code".  For each
  4075.            application (or each version of the application) using RegKey  that
  4076.            requires unique  registration  keys, the  application  developer(s)
  4077.            generate a unique "code  set" using the  utilities included in  the
  4078.            RegKey package. The secret "generation code" is required to  create
  4079.            the unique  registration keys  for  a particular  application.  The
  4080.            "validation code" is used within the  application itself to test  a
  4081.            registration key provided by the user.
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  -----------------------------------------------------------------------------
  4089.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 73
  4090.  
  4091.  
  4092.  
  4093.            ENCRYPTION
  4094.  
  4095.            Encryption is  the process  of translating  information -  such  as
  4096.            written text or  a computer program  - into a  form that cannot  be
  4097.            read by unauthorized  individuals. Only  by knowing  the manner  in
  4098.            which some information has been encrypted, can someone decrypt  and
  4099.            make use of that information. It  is possible to use an  encryption
  4100.            algorithm to encrypt portions of a program's executable file(s), in
  4101.            order to make it more difficult for someone to alter the executable
  4102.            file. This can be  of use when using  RegKey, in order to  increase
  4103.            the security of the RegKey mechanism.
  4104.  
  4105.            RegKey  does  not  provide  any  encryption  capabilities   itself.
  4106.            Depending upon where you live and  what form of encryption you  are
  4107.            using, there may be legal issues  you wish to consider if your  are
  4108.            going to  export  software  using encryption  technology  to  other
  4109.            countries.
  4110.  
  4111.  
  4112.  
  4113.            FILE-BASED REGISTRATION KEYS
  4114.  
  4115.            RegKey supports  two types  of registration  keys -  file-base  and
  4116.            user-entered.  With   file-based   registration  keys,   both   the
  4117.            registration  string (e.g. the  user's name) and  the corresponding
  4118.            registration key code are stored in a registration key file. When a
  4119.            user becomes registered, they receive a small registration key file
  4120.            that is installed in the program's working directory. When a  valid
  4121.            registration key  file  is present,  the  program will  operate  in
  4122.            registered mode.
  4123.  
  4124.  
  4125.  
  4126.            GENERATION CODE
  4127.  
  4128.            RegKey uses the term  "generation code" to refer  to  the numerical
  4129.            key that is  used to generate  registration keys  for a  particular
  4130.            application using  RegKey.  For  each  different  generation  code,
  4131.            different registration keys are generated for the same registration
  4132.            string.  Without  knowing   the  generation  code   used  by   your
  4133.            application,  it  is  infeasible   for  anyone  else  to   generate
  4134.            registration keys that  will work with  your application. For  this
  4135.            reason, you  should  take great  care  to keep  your  application's
  4136.            generation code a secret. You can  use the KeyGen utility included
  4137.            with RegKey to create a new generation code. When a generation code
  4138.            is created, a corresponding "validation  code" is also created.  It
  4139.            is  this  validation  code  that  is  passed  to  RegKey  by   your
  4140.            application when testing the validity of a registration key. It  is
  4141.            not usually  important to  keep the  validation code  a secret,  as
  4142.            knowing it  only  allows someone  to  determine whether  or  not  a
  4143.  
  4144.  -----------------------------------------------------------------------------
  4145.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 74
  4146.  
  4147.  
  4148.            particular registration key  / registration  string combination  is
  4149.            valid for your application.
  4150.  
  4151.  
  4152.  
  4153.            INFEASIBLE
  4154.  
  4155.            The term "infeasible"  is used in  software protection to  describe
  4156.            something that  is very  difficult -  though  not impossible  -  to
  4157.            achieve. For  instance,  even if  someone  were able  to  test  one
  4158.            million registration  keys per  second, it  would still  take  many
  4159.            centuries to discover  a RegKey  registration key  by a  trial-and-
  4160.            error method. Since so  much time would be  required to discover  a
  4161.            RegKey registration key by this method, it is said to be infeasible
  4162.            to "guess" a correct registration key.
  4163.  
  4164.  
  4165.  
  4166.            REGISTERED MODE
  4167.  
  4168.            Programs that use  registration key systems  may operate in  either
  4169.            "registered"  or   "unregistered"   mode.  In   "unregistered"   or
  4170.            "demonstration"  mode,  the  software  may  have  certain  features
  4171.            disabled, may only  operate for a  limited period of  time, or  may
  4172.            display a "please register" message during program operation.  When
  4173.            the user pays  for the software,  they receive  a registration  key
  4174.            corresponding to  their name  or other  personal information.  When
  4175.            this registration key is presented to the application, it will then
  4176.            operate  in  "registered"  mode,  eliminating  any   "unregistered"
  4177.            messages and possibly enabling additional features.
  4178.  
  4179.  
  4180.  
  4181.            REGISTRATION KEY
  4182.  
  4183.            For each  user  who pays  for  your  software, you  use  RegKey  to
  4184.            generate a unique registration key, based on the information of the
  4185.            registration  string  (usually  the  user's  name).  The  resulting
  4186.            registration key is a  96-bit number that  is (in all  probability)
  4187.            unique  for  each  user  that  registers  your  application.   This
  4188.            registration key may either be entered into your application by the
  4189.            user, or may be stored in  a "registration key file" that is  given
  4190.            to the user upon registration. Your application can then use RegKey
  4191.            to determine whether  or not the  registration key  is valid,  thus
  4192.            determining whether or not it should operate in "registered  mode".
  4193.            RegKey represents  the  registration key  as  a 20  digit  base  32
  4194.            number. The  registration  key  returned  to  you  when  generating
  4195.            registration  keys,  and  the  key  presented  to  RegKey  by  your
  4196.            application, is represented  as a 20  character string of  numerals
  4197.            and uppercase  letters.  Hence,  AB7EWBR24LZTUFEY2PLF  might  be  a
  4198.            typical RegKey registration key.
  4199.  
  4200.  -----------------------------------------------------------------------------
  4201.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 75
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.            REGISTRATION KEY FILE
  4208.  
  4209.            When file-based registration keys  are used, both the  registration
  4210.            string (usually the user's name) and the registration key code  are
  4211.            stored in a small  registration key file. This  file usually has  a
  4212.            .KEY filename extension.
  4213.  
  4214.  
  4215.  
  4216.            REGISTRATION STRING
  4217.  
  4218.            A unique  registration  string is  associated  with each  user  who
  4219.            registers your software. This  registration string is usually  just
  4220.            the user or organization's name, but it may also include additional
  4221.            information, such as the registered version or registration  expiry
  4222.            date. In  any case,  the registration  string usually  consists  of
  4223.            information that the user knows prior to registering. When the user
  4224.            pays for your software, you use  RegKey to generate a  registration
  4225.            key  that  corresponds  to   the  registration  string.  When   the
  4226.            registration string is presented to your application in conjunction
  4227.            with the registration key, it can  use RegKey to test the  validity
  4228.            of the registration string / registration key combination, in order
  4229.            to determine whether or not to operate in "registered mode".
  4230.  
  4231.  
  4232.  
  4233.            SHAREWARE
  4234.  
  4235.            A  method  of  marketing   computer  software,  where  the   author
  4236.            encourages the  free  distribution  of the  software.  This  allows
  4237.            potential users  of the  software to  "test-drive" the  application
  4238.            before buying it.  In the shareware approach to software marketing,
  4239.            the user  is usually  required to  either stop  using the  software
  4240.            after a three to four week  trial period, or pay to "register"  the
  4241.            software with the author.
  4242.  
  4243.  
  4244.  
  4245.            SOFTWARE PROTECTION
  4246.  
  4247.            The term "software protection" is used to describe any mechanism or
  4248.            scheme  that  is   used  to  prevent   or  discourage  illegal   or
  4249.            unauthorized use  of  computer  software.  Approaches  to  software
  4250.            protection  include  "copy-protection"  schemes  which  attempt  to
  4251.            prevent a  duplicate  copy of  the  software from  being  produced,
  4252.            "hardware-key"  mechanisms  which  require  a  particular  hardware
  4253.            device (which is sold with the software) to be present in order  to
  4254.  
  4255.  
  4256.  -----------------------------------------------------------------------------
  4257.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 76
  4258.  
  4259.  
  4260.            use the  software, and  "registration-key"  mechanisms such  as  is
  4261.            provided by RegKey.
  4262.  
  4263.  
  4264.  
  4265.            USER-ENTERED REGISTRATION KEYS
  4266.  
  4267.            RegKey supports  two types  of registration  keys -  file-base  and
  4268.            user-entered.  With  user-entered   registration  keys,  the   user
  4269.            manually enters  registration string (e.g. the user's name) and the
  4270.            corresponding  registration  key  code  into  the  application   or
  4271.            configuration program  when  they  first  register.  When  a  valid
  4272.            registration key  has been  entered  for the  entered  registration
  4273.            string, the program will operate in registered mode.
  4274.  
  4275.  
  4276.  
  4277.            UNREGISTERED MODE
  4278.  
  4279.            See "Registered Mode".
  4280.  
  4281.  
  4282.  
  4283.            VALIDATION CODE
  4284.  
  4285.            RegKey uses the term  "validation code"  to refer  to the numerical
  4286.            key that  is used  to test  the validity  of a  registration key  /
  4287.            registration   string  combination,   during   your   application's
  4288.            execution. Your application should pass its unique validation  code
  4289.            to RegKey when it  wishes to test a  registration key. You can  use
  4290.            the KeyGen utility included with RegKey  to create a new validation
  4291.            code /  generation code set  for  a new  application (or  version).
  4292.            Unlike the generation code that should be kept confidential, it  is
  4293.            not usually important to keep the validation code a secret. This is
  4294.            because  knowing  the  validation  code  only  allows  someone   to
  4295.            determine  whether   or   not   a   particular   registration   key
  4296.            /registration string  combination is  valid for  your  application.
  4297.            Knowing the validation  code does  not enable  someone to  generate
  4298.            false registration keys for your application.
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  -----------------------------------------------------------------------------
  4313.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 77
  4314.  
  4315.  
  4316.  INDEX
  4317.  -----------------------------------------------------------------------------
  4318.  
  4319.  
  4320.  
  4321.                 - A -                                    - I -
  4322.  
  4323.  API, 29, 31, 34, 73                      Introduction, 3, 23
  4324.   C/C++, 53
  4325.   QuickBASIC/Visual Basic, 59                            - K -
  4326.   Turbo Pascal, 67
  4327.  Applications of Registration Keys,       KeyGen Program, 13, 18, 19, 27, 28,
  4328.   22                                       29, 30, 31, 32, 37, 41, 49, 50,
  4329.  Author's address, 69                      52, 55, 56, 58, 63, 64, 66, 72,
  4330.                                            74, 77
  4331.                 - B -
  4332.                                                          - O -
  4333.  Branding Software, 22, 73
  4334.                                           Ordering RegKey
  4335.                 - C -                      Agreement, 17
  4336.                                            Filling Order Form, 8
  4337.  Code Sets, 23, 24, 27, 28, 29, 30,        Order Form, 15
  4338.   37, 38, 49, 55, 63, 73, 77               Overview, 7
  4339.  Common Problems, 43                       Price, 11
  4340.  CTL3DV2.DLL File, 20, 27, 43, 72          Source Code, 13
  4341.                                            Terms, 17
  4342.                 - E -
  4343.                                                          - P -
  4344.  Encryption, 74
  4345.  Evaluation Terms, 5                      Porting RegKey, 13, 68
  4346.  Expiry Information, 23, 26, 32, 37,      Principles of RegKey, 23
  4347.   38, 39, 41, 50, 52, 56, 58, 64,         Printing Manual, 1
  4348.   66, 76
  4349.                                                          - Q -
  4350.                 - F -
  4351.                                           QuickBASIC, 3, 19, 36, 44, 46, 54,
  4352.  Features of RegKey, 3                     55, 56, 57, 58, 59, 71, 72
  4353.  File-Base Registration Keys, 74
  4354.  File-Based Registration Keys, 25, 76                    - R -
  4355.  Files, 71
  4356.                                           Registered Mode, 21, 36, 40, 75
  4357.                 - G -                     Registering RegKey. See Ordering
  4358.                                           Registration Key Expiry, 23, 26, 32,
  4359.  Generating Registration Keys, 31          37, 38, 39, 41, 50, 52, 56, 58,
  4360.  Generation Codes, 4, 23, 29, 30, 31,      64, 66, 76
  4361.   32, 33, 41, 42, 43, 49, 50, 52,         Registration Keys, 21, 23, 75
  4362.   55, 56, 58, 63, 64, 66, 73, 74, 77      Registration Strings, 23, 25, 26,
  4363.  Getting Help, 43, 69                      31, 32, 33, 34, 35, 36, 37, 38,
  4364.  Glossary, 73                              39, 42, 50, 51, 52, 53, 56, 57,
  4365.                                            58, 59, 64, 65, 66, 67, 74, 75,
  4366.                                            76, 77
  4367.  
  4368.  -----------------------------------------------------------------------------
  4369.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 78
  4370.  
  4371.  
  4372.  RegKey Files, 71                                        - T -
  4373.  RegKeyFileGenerate() Function, 33,
  4374.   50, 52, 56, 58, 64, 66, 73              Table Of Contents, 2, 18, 46
  4375.  RegKeyFileValidate() Function, 34,       Troubleshooting, 43
  4376.   35, 36, 43, 48, 51, 53, 57, 59,         Turbo Pascal, 3, 19, 36, 44, 46, 61,
  4377.   65, 67, 73                               62, 63, 64, 65, 66, 67, 71
  4378.  RegKeyGenerate() Function, 33, 50,
  4379.   52, 56, 58, 64, 66, 73                                 - U -
  4380.  RegKeyNewCodeSet() Function, 29, 49,
  4381.   50, 51, 52, 53, 55, 56, 57, 58,         Unregistered Mode, 21, 36, 40, 77
  4382.   59, 63, 64, 65, 66, 67, 73              User-Entered Registration Keys, 25,
  4383.  RegKeyValidate() Function, 34, 35,        77
  4384.   36, 42, 43, 48, 51, 53, 57, 59,
  4385.   65, 67, 73                                             - V -
  4386.  
  4387.                 - S -                     Validation Codes, 4, 23, 24, 27, 28,
  4388.                                            29, 30, 34, 35, 37, 42, 43, 49,
  4389.  Security, 4, 6, 12, 13, 21, 27, 40,       51, 53, 55, 57, 59, 63, 65, 67,
  4390.   74                                       73, 74, 77
  4391.  Shareware, 21, 22, 76                    Visual Basic, 3, 19, 36, 42, 45, 46,
  4392.  Software Protection, 42, 76               54, 55, 56, 57, 58, 59, 60, 72
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  -----------------------------------------------------------------------------
  4425.  REGISTRATION KEY SYSTEM 3.00 - PROGRAMMER'S MANUAL                    PAGE 79
  4426.  
  4427.