0

We have a DFM file which began as text file.

After some years, in one of our newer versions, the Borland Developer Studio changed it into binary format.

In addition, the file became infected.

Can someone explain me what should I do now? Where can I find how binary file structure is read?

Johan
  • 74,508
  • 24
  • 191
  • 319
Aharon
  • 117
  • 1
  • 1
  • 14
  • I have no idea what you mean by "infected"... maybe you mean "corrupted"? In any event, run \bin\convert.exe -i -s -t *.dfm That will convert them back to text. Not sure, what you can do about the "infection" – JoelFan May 08 '20 at 00:07

1 Answers1

0

Well, I found what happens to the DFM file, but I don't know why.

The occurence of changing from text file to binary one is known, and could be found in stack overflow in another question. I'll describe only the infection of the file.

In Pascal, the original language of DFM files, a string defines so: first byte is the length of the string (0-255) and the other characters are the string. (Unlike C, which its strings length are recognized by a null character).

Someone (maybe BDS?) while changing the file from text file to binary one, also changed all string of length 13 (0D) to be length 10 (0A). This way, the string finished after 10 chars, and the next char was a value of the property.

I downloaded binary editor, fixed all occurences of length 10, and the file was displayed and compiled well.

(Not only properties' length infected, but also one byte on Icon.Data property was replaced from 0D to 0A)

Aharon
  • 117
  • 1
  • 1
  • 14
  • I seriously doubt that BDS itself altered the DFM data in that manner. DFMs have been used in Delphi for a LONG LONG time, in both textual and binary formats. Both are well supported in the Delphi VCL framework. It is more likely the case that an external source control app or other utility app simply parsed the DFM binary data as textual data by accident and performed line break normalizations on it, converting bare CRs into bare LFs. – Remy Lebeau Jan 15 '13 at 07:14
  • @Aharon - Do you by any chance use SourceSafe and have the dfm's checked in as text io binary? Or can you provide a link to the *changing from text file to binary one is known*. I never had problems with that other than my SourceSafe encounter. – Lieven Keersmaekers Mar 12 '13 at 08:00
  • 2
    @LievenKeersmaekers We use Borland StarTeam, but it seems that the file was changed by BDS at version 2 and checked in as a binary file until I got responsible to fix it. I couldn't understand how developers were able to work on it while it was infected. They told me it was hard. – Aharon Mar 12 '13 at 09:55