Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Procedure to protect - unprotect database
Message
De
09/02/2007 01:43:24
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Procedure to protect - unprotect database
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01193965
Message ID:
01193965
Vues:
67
Dear Experts.

I copy following two procedures from a Foxbase prg. All of the DBF files work fine within Exe. But when someone try to open them by double clicking or even in Foxpro then a message appears "Not a dbf file".

May be this is a good trick to avoid databaes files to open without exe.
Is it possible to use this or such other procedure within Visual Foxpro.

&& FUNCTION PROTECT
PARAMETERS FN
BUFFER=" "
HANDLE=FOPEN(FN,2)
IF HANDLE>-1
   FREAD(HANDLE,@BUFFER,1)
   FBYTE=ASC(BUFFER)
   FSEEK(HANDLE,0,0)
   IF FBYTE=3
      FWRITE(HANDLE,CHR(26),1)
   ENDIF
   FCLOSE(HANDLE)
ENDIF
RETURN .T.
* Function Unprotect
PARAMETERS FN
BUFFER=" "
HANDLE=FOPEN(FN,2)
IF HANDLE>-1
   FREAD(HANDLE,@BUFFER,1)
   FBYTE=ASC(BUFFER)
   FSEEK(HANDLE,0,0)
   IF FBYTE=26
      FWRITE(HANDLE,CHR(03),1)
   ENDIF
   FCLOSE(HANDLE)
ENDIF
RETURN .T.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform