我怎么能知道一个"装配"确实改变? [英] How can I know if an "assembly" really did change?

查看:186
本文介绍了我怎么能知道一个"装配"确实改变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了VS2005一个简单的Hello World应用。这是一个直接的控制台应用程序;它只包含以下行:

I created a simple "Hello World" application in VS2005. It's a straight-forward console application; it only contains the following lines:

Console.WriteLine("Hello World");
Console.ReadLine();

当我试图重建同一个控制台应用程序,而不进行任何改变(只要按下重建按钮),我得到一个稍微不同的可执行文件。 (我产生从第一和第二生成的可执行既是一个SHA-1哈希值,它是不同的!)

When I tried to rebuild the same console application WITHOUT performing any changes (just press the rebuild button), I get a subtly different executable. (I generated a SHA-1 hash from both the 1st and 2nd generated executable, and it's different!)

为什么不一样时,有没有代码的变化?究竟是什么改变了?我用十六进制编辑器来比较,只看到几个不同的字节。

Why is it different when there are no code changes? What actually changed? I used a hex editor to compare and only saw a couple different bytes.

我想我最终的问题是,我怎么能知道一个集结号确实改变? (当然,不看文件版本,文件大小等)

I guess my ultimate question is, how can I know if an "assembly" really did change? (Of course without looking at File versions, file size, etc)

修改

到目前为止,我们已经建立的区别就在于PE头(时间戳和一些调试数据)。在我重新发明轮子,有一个组装比较的工具,忽略了PE头?

So far, we've established that the difference lies in the PE header (timestamp and some debug data). Before I re-invent the wheel, is there an "assembly comparison" tool that ignores the PE header?

谢谢,
伊恩

推荐答案

的差异将是


  • 在PE时间戳头文件

  • 调试数据的GUID,如果存在

(也许更多的东西,按照其他输出您已经发布)看到这些,运行 DUMPBIN /所有/ rawdata中:无。上一个VS命令提示符两个程序集

(and maybe something more, as per the other output you've posted?) To see these, run dumpbin /all /rawdata:none on both assemblies in a VS command prompt.

要做到这一点正确你必须写一个比较工具,理解这一点,忽略这些字节 - 或者把可执行文件的副本,清除了时间戳和GUID,然后比较这些版本。或者,在紧要关头,你可以使用类似 FC / B 的控制狂建议和设想,如果有< 20字节不同(4时间戳,16为GUID),那么它可能是相同的。

To do this properly you'd have to write a comparison tool that understood this and ignored those bytes - or took copies of the executables, cleared the timestamp and GUID and then compared those versions. Or, at a pinch, you could use something like fc /b as controlfreak suggests and assume that if there are < 20 bytes different (4 for the timestamp, 16 for the GUID) then it's probably the same.

您可能使用带有时间戳的装配清除脱身 - AFAIK它只是用来缓存出口符号偏移其他DLL,如果你钩住了 - 但它可能是更安全离开原样。如果你确实需要二进制相同组件,我建议你改变你的流程,这样你永远不干净的构建,除非你真的需要它。

You may well get away with using an assembly with the timestamp cleared - AFAIK it's only used to cache exported symbol offsets in other DLLs if you hook that up - but it's probably safer to leave as is. If you actually need binary-identical assemblies I suggest you change your processes so you never clean-build unless you really need it.

这篇关于我怎么能知道一个&QUOT;装配&QUOT;确实改变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆