gpt4 book ai didi

c# - 对 .NET 应用程序进行 NGEN 是否有助于保护它免于逆向工程?如果不是我什么时候使用它?

转载 作者:行者123 更新时间:2023-11-30 16:33:02 27 4
gpt4 key购买 nike

如果 Ngen 不保护我的应用程序,我什么时候可以合理地期望在我的职业生涯中使用这个应用程序?

最佳答案

Jeffrey Richter 在他的书中写了一篇很棒的文章,我不知道第三版是否有,但这是一篇很棒的文章,他 wrote 2002 年关于 Ngen'ing 的内容仍然具有相关性。

亮点:

Meanwhile, there are several potentialproblems with respect to NGen'd files:

  • No Intellectual Property Protection. Many people believe thatit might be possible to ship NGendfiles without shipping the filescontaining the original IL codethereby keeping their intellectualproperty a secret. Unfortunately, thisis not possible. At runtime, the CLRrequires access to the assemblysmetadata and the NGend files do notcontain the metadata.

  • NGend Files Can Get Out-Of-Sync. When the CLR loads anNGen'd file it compares a number ofattributes about thepreviously-compile code and thecurrent execution environment. If anyof the attributes don't match then theNGen'd file cannot be used and thenormal JIT compiler process is usedinstead.

  • Poor Administration. NGen'd file are not automatically deleted when anassembly is uninstalled adverselyaffecting the .NET Frameworks easyadministration and XCOPY deploymentstory.

  • Inferior Load-Time Performance (Rebasing). When Windows loads anNGend file, it checks to see if thefile loads at its preferred baseaddress. If the file cant load at itspreferred base address, then Windowsrelocates the file, fixing-up all ofthe memory address references. This isextremely time consuming becauseWindows must load the entire file intomemory and modify various bytes withinthe file. For more information aboutrebasing please see my book:Programming Applications for MicrosoftWindows, 4th Edition (MicrosoftPress).

Inferior Execution-Time Performance.

When compiling code, NGen cant make as many assumptions about the execution environment as the JIT compiler can. This causes NGen.exe to produce code with a number of memory-reference indirections that aren't necessary for JIT compiled code

关于c# - 对 .NET 应用程序进行 NGEN 是否有助于保护它免于逆向工程?如果不是我什么时候使用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3591601/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com