4

I am looking to compare two exe files. I should ensure that the existing exe on the server is a product of the code I have now.

I am using

>dumpbin /rawdata oldfile.exe > oldfile.txt
>dumpbin /rawdata newfile.exe > newfile.txt
>fc /b oldfile.txt newfile.txt  //compare them like this
>windiff  oldfile.txt newfile.txt // or this 

I guess they should only differ by the timestamp. These are VB.net exes from visual studio 2003.

Any thoughts?

Thanks.

schar
  • 2,618
  • 5
  • 25
  • 24

4 Answers4

5

If all you're looking to do is verify the binaries are identical, then you could use a utility like md5sum or sha1sum which will effectively hashes the binary. If the hashes for each binary are the same, then the chances are the files are identical.

Chris J
  • 30,688
  • 6
  • 69
  • 111
  • 1
    wont the files have differrent date/time stamps? Can we still rely on the checksum in this case? – schar Aug 19 '09 at 14:08
  • 3
    Getting a checksum/hash of the contents is independent of filetime. Exactly what is it you want to validate? If it's that the contents of file1 ar the same as the contents of file2 irrespective of metadata like date/time stamps, attributes, ownership, etc - then a checksum/hash is good. If you want to validate some or all of the metadata as well, then you'll probably need to combine a number of different tools. – Chris J Aug 19 '09 at 15:56
3

Here's an add-in for Reflector that lets you compare the code between 2 assemblies.

David
  • 34,223
  • 3
  • 62
  • 80
  • Link is broken. I tried to find something similar for JetBrains dotPeek, but haven't succeeded. Telerik has something they call JustAssembly https://www.telerik.com/justassembly , but I tried it out and it wasn't able to tell me anything useful for my particular situation. – RenniePet Jun 07 '18 at 01:31
3

I always use fc with /b option to compare two exes (or any binary files).

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
PREM CHAND
  • 31
  • 2
0

There are date stamps internal to executable files. Wrote a PASS/FAIL program to do this 10 years ago for a build backup process, but lost the code since. Easy to do on your own though.

I remember that after checking the header for the location of the build date stamp and ignoring that address, it was a straight byte to byte block compare.

Droe
  • 11