ctbppat V1.2 c't (unpublished) Andreas Stiller, April 2000 […]
Show full quote
ctbppat V1.2 c't (unpublished) Andreas Stiller, April 2000
A patchprogramm (DOS) for Borland Pascal (BP 7)-EXE files, which produce run time error 200 on faster systems (starting from PII/III and Athlon 266 MHz, K6-2 525 MHz) because of incorrect initialization of a counter for the Delay function
ctbppat is actually a universal tool for scanning, monitoring and patching EXE files. It supports the usual EXE formats MZ (DOS), NE (OS/2, DPMI, Win 3.x) and PE (32 bit format) and analyzes the files, who probably produced the EXE whether Borland Pascal, Turbo Pascal or who else. Quite nicely, if one scans in such a way with bppatch *.* / s [/p] the directories, to list all the file formats and origins of the EXE files (only 8.3-Namen, no long directories).
With / NE or / MZ or / PE one can restrict the files with the appropriate formats to be listed. With pure DOS and Smartdrive this job runs significantly faster.
If ctbppat finds an EXE file (real and DPMI) of Borland Pascal 7,0 it
examines whether it uses an original or changed CRT-Unit, whether this Unit is already patched and whether the Delay function is called at all (then the incorrect initialization is unnecessary).
Depending upon the result it offers a patch. If the Delay function is used, then ctbppat can delay the code with a small delay routine that the Delay function should function correctly up to approximately 4 GHz Pentium III.
For this the BREAK routine in the CRT-Unit is somewhat shortened and the delay code patched into the free space.
In the other case (no DELAY used) the divisor is simply incremented to 65535. Then DELAY does not operate any longer, but the unit is "waterproof" to 300 GHz Pentium III (however not yet tested!).
If the CRT-Unit is changed, but contains the same incorrect
initialization, then ctbpat can at least modify the faulty divisor (default 255 => 1,3 GHz PIII).
ctbppat analyses only original CRT-Units, routines with similar incorrect code in Tool Boxes remains undiscovered. But with
ctbppat filename /brute
one can force that it searches without further analysis for
incorrect initialization Code and offers to patch a new divisor (default 255, or /brute=xxxx with Divisor xxxx). For patching a new file (ex$) is created and the original EXE file is overwritten if desired.
***** attention, please mak a Backup of the files to patch !!!!!
Although the patch software proceeds quite carefully, a warranty for perfect functioning cannot be given. So programs can use overlay operations (Ovr Files), with which patched programs possibly may not work correctly.
All outputs are done in "international language", in order to make it somewhat simpler for our foreign colleagues (at least I hope so ..) .
As a goodie ctbppat contains for insider a small file monitor, which can dump or disassemble the file content or display the entries and segment lists of the EXE headers (MZ, PE, NE). The disassembler displays file addresses and assigned logical addresses. It supports MMX and 3Dnow!, but not yet ISSE or 3Dnow!+
Call: ctbppat filename / mon
Hint for programmers:
The file ftp://ftp.heise.de/pub/ct/ctsi/bppatch.zip contains a changed version of the unit CRT, which will be good for Pentium up to 300 GHz.
Much fun with the exploration of the files,
Andreas Stiller
as@ct.heise.de