Home All Groups Group Topic Archive Search About

Rebuilding dll without any changes and binary differences

Author
19 Jul 2006 11:28 AM
Peri
I build dll and change it's name.
Than I build it again without any changes (neither in code nor dll 
version).
Than I run binary compare on this two dll's and they differ. Why?

--
Piotr

Author
19 Jul 2006 1:41 PM
Carl Daniel [VC++ MVP]
Peri wrote:
> I build dll and change it's name.
> Than I build it again without any changes (neither in code nor dll
> version).
> Than I run binary compare on this two dll's and they differ. Why?

DLLs contain a timestamp in the PE header.  Also, the default
wizard-generated AssemblyInfo contains a FileVersionAttribute that
automatically generates a new file verion every time it's built.

-cd
Author
20 Jul 2006 5:43 AM
Peri
On Wed, 19 Jul 2006 15:41:05 +0200, Carl Daniel [VC++ MVP] 
<cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:

> Peri wrote:
>> I build dll and change it's name.
>> Than I build it again without any changes (neither in code nor dll
>> version).
>> Than I run binary compare on this two dll's and they differ. Why?
>
> DLLs contain a timestamp in the PE header.  Also, the default
> wizard-generated AssemblyInfo contains a FileVersionAttribute that
> automatically generates a new file verion every time it's built.
>
> -cd
>

Do You mean this?
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

VS 2005 doesn't set Versions to 1.0.* by default like VS 2003 did. So the 
version doesn't change on every build.

So what's the way to determine if dll was just rebuild without any changes 
in code? After I build solution I want to determine which dll's really 
changed to include them in application update. Only theese dll's and 
nothing more. Maybe I would be able to skip PE header and start binary 
compare from byte after it? But is PE header always the same size?

--
Peri
Author
21 Jul 2006 2:44 AM
Carl Daniel [VC++ MVP]
Peri wrote:

> So what's the way to determine if dll was just rebuild without any
> changes in code? After I build solution I want to determine which
> dll's really changed to include them in application update. Only
> theese dll's and nothing more. Maybe I would be able to skip PE
> header and start binary compare from byte after it? But is PE header
> always the same size?

You can always binary compare the files and ignore differences in the PE
header.  While the overall size of the PE header may change from one build
to another (if another section was added, for example), the part of the PE
header that contains the date state will always be in the same place between
DLLs built with the same toolset.

-cd

AddThis Social Bookmark Button