开发者

Why does UnitCount differ between PackageInfoTable and TPackageTypeInfo?

开发者 https://www.devze.com 2023-01-10 05:22 出处:网络
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 o

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?


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)...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号