.NET technology FAQ (eight) ----- Intermediate language (IL)

xiaoxiao2021-03-06  61

8. Intermediate Language (IL) 8.1 Can I see the middle language of the component? Yes it is. Microsoft provides a tool called ILDASM that can be used to view metadata and IL of the components. 8.2 Can I get the source code from IL by reverse engineering? Yes it is. Relatively, from IL to regenerate advanced language source code (e.g., C #) is usually very simple. 8.3 How to prevent someone from get my code through the reverse engineering? The only way to run is an ILASM with / owner option. The IL of the component generated can not be viewed through ILDASM. However, the deterministic code of the unconventional code can crack the ILDASM or write its own ILDASM version, so this method can only scare the burst of amateurns. Unfortunate things, current .NET compilers do not / owner options, so you need to protect your C # or VB.NET components, you need to do it below: CSC helloWorld.csildasm /out=temp.il HelloWorld.exeilasm / Owner Temp.il (This suggestion is Hany Ramadan to the DOTNET.) It seems to have an IL encryption tool over time (regardless of Microsoft or third parties). These tools will "optimize" IL in such a way that the reverse project has become more difficult. Of course, if you are writing a web service, the reverse project is no longer a problem, because the customer cannot access your IL. 8.4 Can I use IL to program directly? Yes it is. Peter Drayton posted this simple example in the DOTNET mailing list: .assembly myassembly {} .class myApp {.method static void main () {.entrypoint ldstr "Hello, IL!" Call void system.console :: WriteLine Class System.Object) RET}} Place it in a file called Hello.il, then runs ILASM Hello.il, an EXE component will be generated. 8.5 IL can do something you can't do in C #? Yes it is. Some simple examples are: You can throw an exception exported from systemException, and you can use an array of non-zero start.

转载请注明原文地址:https://www.9cbs.com/read-119082.html

New Post(0)