Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / June 2004

Tip: Looking for answers? Try searching our database.

Same code build twice => diff binary

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Viviana Vc - 05 Jun 2004 14:12 GMT
Hi all,

I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088)
and I noticed that by building the exact same code twice the generated
binaries are different (not much, but they are). To be sure I tried a
simple application like void main(){} and 2 times rebuilding the project
gets 2 different binaries.

Has anybody any clue why this happens?
Could I somehow change a setting or something to remove those diff (I
mean from the same code to get identical binaries)?

Thanks in advance,
Viv
Carl Daniel [VC++ MVP] - 05 Jun 2004 14:41 GMT
> Hi all,
>
[quoted text clipped - 7 lines]
> Could I somehow change a setting or something to remove those diff (I
> mean from the same code to get identical binaries)?

Re-building a small program, I only see a couple bytes difference around
offset 0xe8 in the file.  This is a timestamp that the linker puts in the PE
header that tells when the image was linked.

-cd
Viviana Vc - 07 Jun 2004 11:40 GMT
But I also get the obj different so I thought that this is a compiler
option not linker option.

Viv

>> Hi all,
>>
[quoted text clipped - 13 lines]
>
>-cd
Carl Daniel [VC++ MVP] - 07 Jun 2004 14:09 GMT
> But I also get the obj different so I thought that this is a compiler
> option not linker option.

There may well be timestamps in the .obj files as well, but if so, they
don't influence the output of the linker.

-cd
Viviana Vc - 05 Jun 2004 15:20 GMT
I found the following article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;164151
which tells that indeed the timestamp is the diff, but I couldn't find
in VC++ IDE any setting to disable the timepstamp stuff, and I assume
this should be somehow doable.

Thx,
Viv

>Hi all,
>
[quoted text clipped - 10 lines]
>Thanks in advance,
>Viv
Carl Daniel [VC++ MVP] - 05 Jun 2004 17:18 GMT
> I found the following article:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;164151
> which tells that indeed the timestamp is the diff, but I couldn't find
> in VC++ IDE any setting to disable the timepstamp stuff, and I assume
> this should be somehow doable.

I believe that you assume incorrectly. There is no option to suppress the
timestamp - it's a required part of the PE header.

-cd
Viviana Vc - 07 Jun 2004 11:41 GMT
That is sad :( I am having an update feature in my product, and because
of the timestamp it will have to update all the binaries, even though
they are identical.

>> I found the following article:
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;164151
[quoted text clipped - 6 lines]
>
>-cd
Russell Hind - 07 Jun 2004 12:15 GMT
Maybe a different way of handling updates is required, not based on
binary compares.

Cheers

Russell

> That is sad :( I am having an update feature in my product, and because
> of the timestamp it will have to update all the binaries, even though
> they are identical.
Julie - 07 Jun 2004 17:58 GMT
> That is sad :( I am having an update feature in my product, and because
> of the timestamp it will have to update all the binaries, even though
[quoted text clipped - 10 lines]
> >
> >-cd

Or -- you could use a PE editor and manually change the timestamp to a value of
your liking...
Viviana Vc - 08 Jun 2004 11:48 GMT
Already tried that.
I have used the editor downloaded from:
http://www.softpedia.com/public/cat/5/4/5-4-4.shtml

I changed the time stamp and still there are 2 diffs between the exes
(initially there were 3 diffs).

Viv

>> That is sad :( I am having an update feature in my product, and because
>> of the timestamp it will have to update all the binaries, even though
[quoted text clipped - 13 lines]
>Or -- you could use a PE editor and manually change the timestamp to a value of
>your liking...
Michael J. Mooney - 07 Jun 2004 19:16 GMT
Is there a can't you use version numbers to identify binary versions?

Signature

Michael J. Mooney
MCP+SB, MCAD, MCSD

> That is sad :( I am having an update feature in my product, and because
> of the timestamp it will have to update all the binaries, even though
[quoted text clipped - 10 lines]
> >
> >-cd
Jussi Jumppanen - 08 Jun 2004 01:32 GMT
> That is sad :( I am having an update feature in my product, and
> because of the timestamp it will have to update all the binaries,
> even though they are identical.

But that is the point, they are not identical as the two
binaries have a different PE information.

Why not change the diff program so that it skips over the PE
header, in which case it would report no differences in the
binaries.

Jussi Jumppanen
Author of: Zeus for Windows (All new version 3.92 out now)
"The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com
Viviana Vc - 08 Jun 2004 11:50 GMT
Any tool I could use for skipping the PE header?
As I said I already tried to change the time stamp in the PE header
using a PE editor, but still there are 2 diffs between the exes
(initially there were 3).

Viv

>> That is sad :( I am having an update feature in my product, and
>> because of the timestamp it will have to update all the binaries,
[quoted text clipped - 11 lines]
>"The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
>Home Page: http://www.zeusedit.com
Andrew McDonald - 11 Jun 2004 00:28 GMT
Can't you include a version info resource and check the version number?

Andrew

> That is sad :( I am having an update feature in my product, and because
> of the timestamp it will have to update all the binaries, even though
[quoted text clipped - 8 lines]
> > > in VC++ IDE any setting to disable the timepstamp stuff, and I assume
> > > this should be somehow doable.
Viviana Vc - 14 Jun 2004 11:42 GMT
I could of course, but the problem is like this: I have let's say a
binary that uses common code from other libraries, like some header
files, so would be hard to know when to change the version number ...
There are many developers working on the same header files, so hard to
check if something has changed in order to change the version number.

>Can't you include a version info resource and check the version number?
>
[quoted text clipped - 12 lines]
>> > > in VC++ IDE any setting to disable the timepstamp stuff, and I assume
>> > > this should be somehow doable.
Walter Briscoe - 14 Jun 2004 14:50 GMT
In message <2j5dm4FtnmhnU1@uni-berlin.de> of Mon, 14 Jun 2004 12:42:52
in comp.os.ms-windows.programmer.misc, Viviana Vc
<vcotirlea@hotmail.com> writes
[Poster wants an executable built twice to compare equal.
Poster cross-posted to 5 newsgroups and should consider fewer. The same
poster started another thread in 9 newsgroups. This is unlikely to be
productive. Some knowledgeable people would ignore the posting on that
basis. They are a LOT better than corresponding multi-postings.]

>I could of course, but the problem is like this: I have let's say a
>binary that uses common code from other libraries, like some header
>files, so would be hard to know when to change the version number ...
>There are many developers working on the same header files, so hard to
>check if something has changed in order to change the version number.

If you use a project file (Microsoft's term for Makefile) appropriately,
your product will be rebuilt if and only if a contributing component
changes. Version control systems can help in organising this.

Your problem is in a class which is not reasonably soluble with the sort
of technique you hope to apply.

If I wanted to solve your problem, I would find or write a PE dumper - I
can propose no suitable URL - and then compare files with boring things
filtered from the comparison. Hopefully, this will work.

I usually take the line that files with different dates or sizes are
different. This is a fairly conservative approach. It is highly likely
that the "same" thing can not be built on my machine and yours or even
twice on mine. The same river can not be viewed twice. ;)
Signature

Walter Briscoe


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.