0

If you put a breakpoint in System._StartExe and examine the InitTable that gets passed in, you'll notice that InitTable.UnitCount is greater than InitTable.TypeInfo.UnitCount. Unfortunately, neither of these records are documented very well. Does anyone know what these two numbers represent and why they're different? I assume InitTable.UnitCount is the total number of units in the application. But what's the other one?

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
  • UnitCount tells how many entries are in the accompanying UnitInfo table. I assume TypeInfo.UnitCount corresponds to something similar. Can you compare those two tables to see how their contents differ? – Rob Kennedy Aug 05 '10 at 22:08
  • @Rob: Not really. The two tables show different sets of data about their respective units, with no overlap as near as I can tell. The first table doesn't even include unit names, which makes me wonder where programs like DeDe were extracting them from in EXEs compiled pre-D2010. – Mason Wheeler Aug 05 '10 at 22:23

1 Answers1

3

I believe that
- PackageInfoTable.UnitCount counts the units stored in the UnitInfo array, where each record holds the initalization and finalization code pointers for the units parts of the package.
- PackageInfoTable.TypeInfo.UnitCount along with ...UnitNames references the Units containing some TypeInfo stored in the TypeTable (real Type Info or unit boundary marker).

A unit can contain some Init/Finit code but no TypeInfo to gather and reciprocally, hence the difference...

FYI, look at procedure ChangeFinalizationsOrder in MemCheck.pas to see how they hack the InitTable (up to D2006)...

Francesca
  • 21,452
  • 4
  • 49
  • 90