Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if two exe's are the same code-wise?

Is there a way to detect whether two EXE's (compiled from VS.Net 2008 for C++/MFC) do not have any code-level changes between them i.e. for purposes of knowing that there have been no statement changes.

This is for compliance purposes when my vendor ships me an exe, ostensibly with no changes made to the code since the last time we tested it.

Is there a tool to check that this is so?

Cheers

like image 617
yumcious Avatar asked Apr 09 '10 03:04

yumcious


3 Answers

You could use a dissembler to disassemble the executable back into assembly and compare with a normal text diff tool.

But even that will not be 100% accurate. The compilation process is not lossless and much information is lost or irreversibly transformed when C++ code is compiled.

In particular, different compiler settings can generate vastly different machine code from exactly the same source. Different compilers and even different versions or service-pack/hotfix levels of the same compiler can produce vastly different machine code from the same source files.

The other question is, why are they even sending you the exe back "ostensibly with no changes made"? If that's the case, why don't you just use the one you had originally?

like image 117
Dean Harding Avatar answered Sep 19 '22 05:09

Dean Harding


You can always perform an MD5sum on the executables. This won't tell you whether they are logically equivalent or different, simply that a difference exists.

I'm not sure if this solves your issue, as you may be looking for a logical comparison tool.

like image 45
Ryan Avatar answered Sep 20 '22 05:09

Ryan


Automate your testing so that the tests can be rerun quickly.

Even though this is a small statement to make, it is a big undertaking

like image 24
benPearce Avatar answered Sep 19 '22 05:09

benPearce