Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foxfix, any experience?
Message
From
09/10/2002 09:14:26
 
 
To
09/10/2002 05:21:38
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00708877
Message ID:
00709217
Views:
25
UPDATE: Look at the foxfix5.ini I included also. Make sure those settings for archive files (check logging section), etc at the top are accurate and the paths exist in your app BEFORE you attempt to call foxfix5.l. Also, put the foxfix5.ini in your users system32 directory to repress the splash screen and ensure it is the one always used by foxfix5.1

Our tables are 2.x dbfs also used by both FPD26 apps and VFP7 apps. Here is how we do it:

SNIPPET OF APPLICABLE PORTION IN OUR USEFILE.PRG
USAGE: =UseFile("INSURED",ddir,"NAME", [expC], [expC], [expC] )
*:***************************************************************************
*: Procedure file: USEFILE.PRG
*:***************************************************************************
*
* PURPOSE: Open database and correct any detected problems.
*
* USAGE: =UseFile("INSURED",ddir,"NAME", [expC], [expC], [expC] )
*
* PARAMETERS:
* ufile    = File to open
* udir     = Directory
* uorder   = Index Tag Name
* ualias   = Alias
* uparm1, uparm2, uparm3 = AGAIN, EXCLU or NOINDEX
*
* Top portion of usefile.prg only:

PARAMETERS ufile,udir,uorder,ualias,uparm1,uparm2,uparm3

PRIVATE xreturn
xreturn = .F.

IF EMPTY(ufile)
    WAIT WINDOW 'Error in USEFILE.PRG - File name is missing.'
    RETURN xreturn
ENDIF
IF '.' $ ufile
    ufile = LEFT(ufile,AT('.',ufile)-1)
ENDIF

IF EMPTY(udir)
    udir = ''
ELSE
    IF RIGHT(udir,1) <> '\'
        udir = udir + '\'
    ENDIF
ENDIF

IF EMPTY(ualias)
    ualias = ufile
ENDIF

uagain = .F.
uexclu = .F.
ureindex = .T.
unoselect = .F.

IF !EMPTY(uparm1)
    DO setparms WITH uparm1
ENDIF
IF !EMPTY(uparm2)
    DO setparms WITH uparm2
ENDIF
IF !EMPTY(uparm3)
    DO setparms WITH uparm3
ENDIF

errnum = 0
ON ERROR errnum = ERROR()

DO openfile

DO CASE
    CASE errnum = 0								&& No Error
        xreturn = .T.
    CASE errnum = 1								&& File "<file>" does not exist.
        =okay("The file "+udir+ufile+".DBF is missing.  Run ATIFIX to recreate or restore from backup.")
    CASE errnum = 3								&& File is in use.
        =okay("The file "+ufile+".DBF is in use.  Please check other workstations.")
    CASE errnum = 41 AND !FILE((udir+ufile+'.FPT'))	&& MEMO file is missing/invalid.
        =okay("The file "+ufile+".FPT is missing.  Run ATIFIX to recreate or restore from backup.")
    CASE errnum = 108							&& File is in use by another.
        =okay("The file "+ufile+".DBF is in use by another.  Please check other workstations.")
    CASE errnum = 1705							&& File access denied.
        =okay("File access denied on "+ufile+".DBF.  Please check other workstations.")
    CASE INLIST(errnum,19,114,1707)
        *---19   Index file does not match table.
        *---114  Index does not match table.  Recreate index.
        *---1707 Structural CDX file not found.

        IF ureindex AND yesno("The index file "+ufile+".CDX is corrupted or missing.  Reindex?")
            DO idxfiles WITH ufile,.F.,.F.
            RELEASE WINDOW showidx
        ENDIF

        DO openfile

        xreturn = IIF(errnum=0,.T.,.F.)
    OTHERWISE
        IF yesno("The file "+ufile+".DBF is corrupted.  Attempt to repair?")

            *--TCH 10/8/2001 Visual Foxpro and FoxFix 5.1 Modifications
            #IF 'VISUAL' $ UPPER(VERSION())
                *--FOXFIX5.1 commands to fix table
                DO loadff5									&& declares env varialbles for dll
                =FF_SCAN(udir+ufile+'.DBF',-1)		&& -1 = fix all errors
            #ELSE									&& DOS 2.6 Version
                SET LIBRARY TO FOXFIX.PLB
                =FIXDBF(udir+ufile+'.DBF',1)
                SET LIBRARY TO
            #ENDIF

            DO openfile

            IF errnum = 0
                xreturn = .T.

                IF ureindex
                    USE

                    DO idxfiles WITH ufile,.F.,.F.
                    RELEASE WINDOW showidx

                    DO openfile
                ENDIF
            ELSE
                =okay("The file "+ufile+".DBF can NOT be fixed.  Run ATIFIX to recreate or restore from backup.")
            ENDIF
        ENDIF
ENDCASE

IF xreturn AND !EMPTY(uorder)
    errnum = 0
    SET ORDER TO TAG (uorder) IN (ualias)
    *(DD - 04/04/2000 Added 1683 to errnum list - TAG NOT DEFINED
    IF INLIST(errnum,26,19,114,1707,1683)
        xreturn = .F.
        IF yesno("The "+ufile+" file cannot be ordered. Try to Reindex?")
            USE

            DO idxfiles WITH ufile,.F.,.F.
            *(DD - Added ON ERROR statement
            ON ERROR errnum = ERROR()
            RELEASE WINDOW showidx

            DO openfile

            SET ORDER TO TAG (uorder) IN (ualias)

            *(DD - 04/04/2000 - Added error check again
            IF INLIST(errnum,26,19,114,1707,1683)
                xreturn = .F.
                DO okay WITH uorder+' index not defined in '+ualias+'! Have all users; exit and reindex all data/system files.'
            ELSE
                xreturn = .T.
            ENDIF
        ENDIF
    ENDIF
ENDIF

ON ERROR DO errors WITH PROGRAM()

RETURN xreturn

*------------------------------------------------
PROCEDURE openfile

    errnum = 0

    IF USED(ualias) AND !uagain
        IF !unoselect
            SELECT (ualias)
        ENDIF
    ELSE
        IF unoselect
            IF uexclu
                USE (udir+ufile) ALIAS (ualias) IN SELECT(1) EXCLU
            ELSE
                USE (udir+ufile) ALIAS (ualias) IN SELECT(1)
            ENDIF
        ELSE
            SELECT 0
            IF uexclu
                USE (udir+ufile) ALIAS (ualias) EXCLU
            ELSE
                USE (udir+ufile) ALIAS (ualias)
            ENDIF
        ENDIF
    ENDIF
RETURN
LOADFF5.PRG (actually resides inside the usefile.prg above)
PROCEDURE loadff5

#IF 'VISUAL' $ UPPER(VERSION())		&& VFP3 or above version
        DECLARE INTEGER FF_Scan	IN FoxFix5.DLL STRING Filename, INTEGER FixMode
        DECLARE INTEGER FF_Initialize		IN FoxFix5.DLL STRING ModuleName
        DECLARE INTEGER FF_WatchDLL 		IN FoxFix5.DLL STRING ModuleName
        DECLARE INTEGER FF_SetConfigFile        IN FoxFix5.DLL STRING ConfigName
        DECLARE INTEGER FF_GetLastErrorCode     IN FoxFix5.DLL INTEGER bFixed
        DECLARE STRING  FF_GetLastErrorFile 	IN FoxFix5.DLL
        DECLARE STRING  FF_GetLastLogFile       IN FoxFix5.DLL
        DECLARE         FF_SetStealthFixMode 	IN FoxFix5.DLL INTEGER FixMode
        DECLARE INTEGER FF_GetStealthFixMode 	IN FoxFix5.DLL
        DECLARE         FF_SetEnableStealth 	IN FoxFix5.DLL INTEGER Setting
        DECLARE INTEGER FF_GetEnableStealth 	IN FoxFix5.DLL
        DECLARE         FF_SetGenerateAccessDenied 	IN FoxFix5.DLL INTEGER Setting
        DECLARE INTEGER FF_GetGenerateAccessDenied 	IN FoxFix5.DLL
#ENDIF
RETURN

FUNCTION DecodeErrors
#IF 'VISUAL' $ UPPER(VERSION())			&& VFP3 or above version
        PARAMETER FFError
        Msg = ""
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_VERSION_ID) != 0, "Version ID"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_DATE) != 0, "Last Updated"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_RECORD_CNT) != 0, "Record Count"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_HEADER_LEN) != 0, "Header Length"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_RECORD_LEN) != 0, "Record Length"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FLAGS) != 0, "Flags"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_CODEPAGE) != 0, "Code Page"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FIELD_DESCRIPTORS) != 0, "Field Descriptors"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FLT_MARKER) != 0, "Field List Terminator (FLT)"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_DBC_BACKLINK) != 0, "DBC Backlink"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_DELETE_FLAG) != 0, "Delete Flag"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FIELD_DATA) != 0, "Field Data"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_MEMO_POINTERS) != 0, "Memo Pointers"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FILE_LENGTH) != 0, "File Length"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_DBF_FIELDS_AUTO_SHIFTED) != 0, "Fields Auto Shifted"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_FPT_NEXTBLOCK) != 0, "FPT Next Available Block"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_FPT_CORRUPT_BLOCK_HEADERS) != 0, "Corrupt memo block header"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_FPT_BLOCKSIZE) != 0, "Block Size"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_FPT_FILE_LENGTH) != 0, "FPT File Length"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_CDX_STRUCTURE) != 0, "CDX Structure"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_CDX_EXPRESSIONS) != 0, "CDX Expressions"+CHR(13), "" )
        Msg = Msg + IIF( BITAND(FFError, BAD_CDX_FILE_LENGTH) != 0, "CDX File Length"+CHR(13), "" )
#ENDIF
RETURN Msg
c:\winnt\system32\foxfix5.ini
[General]
CheckSharedFiles=TRUE
DisableAnimation=FALSE
VerboseMessages=FALSE
DeleteDataScanFiles=TRUE
DeleteErrorLogFile=FALSE
KeepLogsWithErrors=TRUE
RememberWindowPos=FALSE
ShowToolTips=TRUE
Top=10
Left=80
Width=640
Height=580
DateFormat=1
Epoch=1971
ReadOnlyCalcValues=TRUE
MRUCount=2
MRULimit=20
MaxErrors=500
GenerateInfoLogs=TRUE
[DLL]
EnableStealthRepair=TRUE
HookDynamicLoadedDLLs=TRUE
GenerateAccessDenied=FALSE
ExcludedModuleCount=3
ExcludedModule0=COMCTL32.DLL
ExcludedModule1=COMDLG32.DLL
ExcludedModule2=VERSION.DLL
FileMaskCount=2
FileMask0=*.DBF
FileMask1=*.DBC
DisplaySplashOnLoad=FALSE
DisplayStatusOnLoad=FALSE
[Logging]
ArchivePath=..\archive
MessageLogFilename=..\Logs\foxfix.log
WriteArchive=TRUE
WriteMessageLog=TRUE
AppendMessageLog=FALSE
LockArchive=FALSE
EmitPatchData=TRUE
UseAlternatePath=TRUE
AlternatePath=..\logs
DumpHeaders=TRUE
LogNamesAsUNC=FALSE
[Table]
UserDBFExt=FIX
LockAttempts=5
CheckLastModifiedDate=TRUE
EnforceOffsets=TRUE
MaxDescriptorErrors=2
ShiftResyncWindow=4
AutoShiftDescriptors=TRUE
MaxAutoShifts=16
EnableNonFoxChecks=FALSE
ForceFileType=FALSE
ForceFoxPro26=FALSE
CheckCodepage=TRUE
Codepage=437
ForceCodepage=TRUE
DBCMatchLength=100
ExtendTruncatedDBF=TRUE
WriteFLT=TRUE
AllowExtHeader=FALSE
AllowExtHeaderBytes=1
[Memo]
MemoExistsAction=1
MemoMissingAction=1
DetermineBlocksize=0
UserDefinedBlocksize=64
MemoDisplayMaxInKB=8
MemoDisplayMaskNulls=TRUE
GenerateOrphansTable=TRUE
OrphansForMemos=TRUE
OrphansForGenerals=FALSE
MemoLengthThreshold=0
[Index]
ValidateFields=TRUE
ValidateFunctions=TRUE
GenerateReindexCode=TRUE
FunctionCount=105
Function0=!
Function1=ALIAS
Function2=ALLTRIM
Function3=AND
Function4=ANSITOOEM
Function5=ASC
Function6=AT
Function7=ATC
Function8=ATCLINE
Function9=ATLINE
Function10=BETWEEN
Function11=BINTOC
Function12=BOF
Function13=CEILING
Function14=CHR
Function15=CHRSAW
Function16=CHRTRAN
Function17=CMONTH
Function18=CTOBIN
Function19=CTOD
Function20=CTOT
Function21=DATE
Function22=DATETIME
Function23=DAY
Function24=DBF
Function25=DELETED
Function26=DIFFERENCE
Function27=DMY
Function28=DOW
Function29=DTOC
Function30=DTOR
Function31=DTOS
Function32=DTOT
Function33=EMPTY
Function34=EOF
Function35=FIELD
Function36=HOUR
Function37=IIF
Function38=INLIST
Function39=INT
Function40=ISALPHA
Function41=ISDIGIT
Function42=ISLOWER
Function43=ISUPPER
Function44=LEFT
Function45=LEN
Function46=LIKE
Function47=LOOKUP
Function48=LOWER
Function49=LTRIM
Function50=MAX
Function51=MDY
Function52=MIN
Function53=MINUTE
Function54=MOD
Function55=MONTH
Function56=NOT
Function57=OCCURS
Function58=OEMTOANSI
Function59=ON
Function60=OR
Function61=PAD
Function62=PADC
Function63=PADL
Function64=PADR
Function65=PAYMENT
Function66=PI
Function67=PROPER
Function68=PV
Function69=RAND
Function70=RAT
Function71=RATLINE
Function72=RECCOUNT
Function73=RECNO
Function74=RECSIZE
Function75=RELATION
Function76=RIGHT
Function77=ROUND
Function78=RTOD
Function79=RTRIM
Function80=SEC
Function81=SECONDS
Function82=SEEK
Function83=SIGN
Function84=SIN
Function85=SOUNDEX
Function86=SPACE
Function87=SQRT
Function88=STR
Function89=STRTRAN
Function90=STUFF
Function91=SUBSTR
Function92=SYS
Function93=TAG
Function94=TAN
Function95=TARGET
Function96=TIME
Function97=TRANSFORM
Function98=TRIM
Function99=TTOC
Function100=TTOD
Function101=TYPE_6
Function102=UPPER
Function103=VAL
Function104=YEAR
[Colors]
Color0=0x00D926C7
Color1=0x00EA8AE0
Color2=0x00EAA515
Color3=0x00F5D99C
Color4=0x00E6427B
Color5=0x00F2A2BE
Color6=0x00B0E6FF
Color7=0x00B0FFEC
Color8=0x0000FF80
Color9=0x00C0C0C0
Color10=0x00B0E6FF
Color11=0x00B0FFEC
Color12=0x00D7FF6A
Color13=0x00E3FF9B
Color14=0x00FFBA75
Color15=0x00FFCD9B
Color16=0x008080FF
Color17=0x0080FFFF
Color18=0x0080FF80
Color19=0x00FFFF80
Color20=0x00FF8000
Color21=0x00C080FF
Color22=0x004AA8FD
Color23=0x00FFFF80
Color24=0x00FF8000
Color25=0x00B0B0FF
Color26=0x004BA09C
Color27=0x0083C5C1
Color28=0x00FFCD9B
Color29=0x00FFBA75
Color30=0x00E3FF9B
Color31=0x00D7FF6A
Color32=0x0000FFFF
Color33=0x0080FF80
Color34=0x00A0FFA0
HiLightFactor=0x00DFDFDF
[Advanced]
BadCharReplacement=46
DefaultColumns=16
UIResponse=3
ValidDeleteClear=32
ValidDeleteSet=42
FieldWarningMask=0x0000
DebugMode=FALSE
EnableALF=TRUE
EnableDataScan=TRUE
UseInternationalCS=FALSE
CSEngFirst=000000000000000087FFFFFE07FFFFFE00000000000000000000000000000000
CSEngOther=0000000003FF000087FFFFFE07FFFFFE00000000000000000000000000000000
CSIntFirst=000000000000000087FFFFFE07FFFFFE07FFFFFF0000003F0000000000003FFF
CSIntOther=0000000003FF000087FFFFFE07FFFFFE07FFFFFF0000003F0000000000003FFF
[FF5Tools]
LastXFPFile=
DefaultXfpPath=
>We planned to use the DLL and to set FF_SetStealthFixMode(-1) (scan and fix). After the first time we started our app, we got many "???_Log.XFL" files and experienced frequent locks among users.
>
>As we share 2.x DBFs between VFP and FPW apps, we were wondering if we should rather only FF_Scan() when needed (ex. after an error when we USE the DBF).
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform