开发者

Compare two .exe for differences (both created on same machine)

I am trying to test that Visual Studio generates a predictable/repeatable executable from the same code.

To do this, I'm creating a small program (one .cpp file) and building a .exe (A), making some changes and making another .exe (B), then un-doing the changes and making another .exe (C).

My theory is that the informatio开发者_JS百科n for A and C will be the same and confirm that MSVS generates predictable/repeatable .exe's from the same code.

Several problems:

(i've saved the results of the commands in .txt's)

I've used dumpbin /rawdata to get rid of time/date stamp data and save the raw contents of each section of the file (not entirely sure what "raw" means), but that leaves 2 lines of difference when comparing with windiff.

Running dumpbin /headers shows differences in the .rdata section (Raw Data #2) under Debug Directories; the differences are in the time (which is expected) and in the Format: X, {Y}, "difference here", Z column.

I've searched forums and msdn for hours and cannot find a solution using dumpbin. Similar forum posts have ended with shrugged shoulders.

Can anyone give me a hand? I will do my best to add more specificity as requested.

Thank you, ZayJay

Viewed References:

http://support.microsoft.com/kb/177429

http://support.microsoft.com/kb/164151

http://msdn.microsoft.com/en-us/windows/hardware/gg463119.aspx

http://www.ms-news.net/f3614/how-can-i-compare-2-executables-1980031.html

+ others...

Also, running a comparison between my .cpp and a new .cpp with a main that only returns 0 yielded differences in the same areas. I expected there to be differences in the .text (Raw Data #1) section of the dumpbin /headers results... Anything to read or straight up answers would be great! thanks!


There are a few fields in the portable executable format which will change every compilation (PE format is used for .exe and .dll). Writing a parsing app that memory maps such an exe and walks its internal datastructures isn't too hard (it is, in fact, what dumpbin does). You'll basically need to ensure that you exclude any GUIDs, date stamps, and anything else that might reasonably change.

The references section of http://en.wikipedia.org/wiki/Portable_Executable (the PE format docs from Microsoft) explain the format. I've written a similar app (mine was to extract version information of the resources section) and found the documentation to be pretty good.

That said, this seems like a bit of a waste of time. Modern compilers are fantastic at what they do. And they generally don't have randomness thrown into them, so you should expect the .rdata, .data and .text sections to be generally the same. In general, when you start questioning your compiler (especially a big one like Visual Studio or gcc), chances are you should take a deep breath and go back and look at your own code. Bugs are few and far between. And the few that there are usually have MSDN/StackOverflow articles written about them already.

(In other words: what exactly are you trying to accomplish?)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜