Hi!
I get some sort of corruption in a fairly large exe, which is probably caused by a corruption in a class library or a scx. The worrying part is that compiling the project (with recompile all) doesn’t give any indication that anything is wrong. When running the application, it will fail some times on some machines. It seems there is a higher chance of getting the error when the exe is started from a shortcut than when starting by a double-click. This is the first time I’ve seeing this in Vfp.
I haven’t yet found which class library that is causing this, but this is not really my question. What I’m trying to figure out is if there is a way to check a vfp exe file if there any characters that are not supposed to be present in a compiled exe? The idea is to have a small routine that scans an exe and checks to see if there are any characters or combination of characters that never should occur in a compiled exe. It would be reassuring to have a test to run before installing a corrupt exe on 400 computers, which I did the other day.
The small test program below reads each character from an exe and stores the ansi value in a table. Are there any values that should never be there? I know this a long shot, but it would be interesting to see if anybody has some intimate knowledge of the structure of a compiled exe.
CLOSE ALL
CLEAR ALL
llOldAutoYield = _VFP.AutoYield
lcOldSafety = SET("SAFETY")
lcFile = GETFILE("EXE", "File to test")
IF EMPTY(lcFile)
RETURN
ENDIF
SET SAFETY OFF
_VFP.AutoYield = .T.
CREATE TABLE Distrib (Chars I, CharCount I)
INDEX ON Chars TAG Chars
SET ORDER TO
lcData = FILETOSTR(lcFile)
lnCount = LEN(lcData)
FOR lnI = 1 TO lnCount
IF MOD(lnI, 20) = 0
WAIT WINDOW NOWAIT TRANSFORM(lnI)
ENDIF
lcChar = SUBSTR(lcData, lnI, 1)
lnAsc = ASC(lcChar)
IF !SEEK(lnASc, "Distrib", "Chars")
INSERT INTO Distrib (Chars) VALUES (lnAsc)
ENDIF
REPLACE CharCount WITH CharCount + 1 IN Distrib
IF lnI >= 1000
EXIT
ENDIF
ENDFOR
_VFP.AutoYield = llOldAutoYield
IF lcOldSafety = "ON"
SET SAFETY ON
ENDIF
SET ORDER TO Chars
BROWSE