For my program delphi-code-coverage-wizard, I need to verify that a (detailed) mapping file .map matches a Delphi application .exe
Of course, this verification should be realized with Delphi.
Is there a way to check it ? Maybe by verifying some information from the EXE ?
I think a quite simple heuristic would be to check that the various sections in the PE file start and finish at the same place:
For example, here’s the top of a map file.
I also looked at what
dumpbin /headershad to say about these sections:Look at the .text section. According to dumpbin it starts at
00401000and finishes at004A5937which is a length of000A4938, exactly as in the .map file. Naturally you’d read the PE file directly rather than running dumpbin, but this illustrates the point.I’d expect a vanishingly small number of false positives with this approach.