Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to license software?
Message
 
À
29/07/2002 15:22:03
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00683104
Message ID:
00683795
Vues:
28
Hello again Ravi,

>Does the .exe file launch your main application?

The .exe file is my application. I've compiled a "Win32 executable / COM server (exe)". It's not a real big complicated app.

OK, I can create a new table - to hold key information such as NumOfUsers, clientNum etc? And then rename it as e.g. App.Key? Would that be using the save as command?

Here's how the new table is created:
CREATE TABLE MyFoxApp.KEY  FREE  (mystuff C(54), cksum C(9))
>>Inside the keyfile are several records that are used to set application-wide variables, including the user's name, etc. The app.key file also contains a field that has the checksum of the first field. That way if a more advanced user has figured out that they can open the keyfile and alter it's contents, the checksum will be incorrect, and the program will refuse to continue.
>>
>What does checksum do here - I am a bit confused here.


In the field 'mystuff' you can put part or all of a line of code, and in the cksum field you put the checksum of the first field. For example:
REPLACE mystuff  WITH "10 TO gnMaxUsers"
REPLACE cksum  WITH SYS(2007,mystuff+"ABCD")
Of course you would change the ABCD to some random but meaningful string that only you know.

Now, when you open the file, before executing the code in the mystuff field, you prove that the cksum field is equal to the value returned by SYS(2007) for mystuff+"ABCD"). If not, you warn the user that 'their keyfile is corrupt' and they have to call you to fix the situation. The more advanced user may figure out how to open the DBF-in-disguise file and change the 10 to a 50, but would not likely know what has to be done to the cksum field to make it work with the program.
STORE .F.  TO failed
SCAN
  IF SYS(2007,mystuff+"ABCD")=RTRIM(cksum)
    STORE RTRIM(mystuff)  TO v2v
    STORE &v2v.      && Create the variable
  ELSE
    STORE .T.  TO failed
    EXIT
  ENDIF
ENDSCAN
IF failed
  MESSAGEBOX("Dear User, your keyfile is corrupt....')
ENDIF
Make sense?
HTH,
Randy Bosma
VFP - Because life is too short to code in something else...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform