# [.net] .NET Decompile Protection

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Quote:
 Original post by Anonymous PosterNo. C# is not C++. You are, frankly, mad if you think you can get all the features of .NET (no, not just 'C#', .NET in general) and still compile to machine code.No offense, but your argument is pathetic - you keep reiterating the same point over and over again, and I believe it is starting to grate on our nerves. We already debunked your rationale for this, so there's very little being argumentative about the issue can accomplish for you.So, to answer your question: no, you cannot compile C# straight down to machine code. It requires the .NET runtime much in the same way that Java requires the JRE. ;)

You are wrong. There is a way to do it. If you want to spend lots of money.

http://www.remotesoft.com/salamander/protector.html.

I'm not spending $1899 for a peice of software that does what a C++ compiler does (that you can get for free). I also never said C# is C++... I said C# to be compiled the same exact way as C++. Meaning, C# compiled to NATIVE CODE, not MSIL. Quote:  No offense, but your argument is pathetic - you keep reiterating the same point over and over again, and I believe it is starting to grate on our nerves. We already debunked your rationale for this, so there's very little being argumentative about the issue can accomplish for you.So, to answer your question: no, you cannot compile C# straight down to machine code. JIT does this during runtime of all .NET Programs. It stores it in a cache (the native code version). If you haven't noticed, all .NET programs have a SLOW load time for the first time. I really hate this, because even ASP.NET-based websites do this if they haven't had visitors for a long time. I'm not starting an argument. I am trying to find out if in fact it is possible there is a FREE application similiar to Remotesoft's Protector. By "our nerves" do you mean the nerves of all the anonymous posters? Answer this- Why does .NET convert to MSIL? To make .NET PORTABLE? If this is true- what if I do NOT want my application to be portable? Why am I forced to make it portable? #### Share this post ##### Link to post ##### Share on other sites Advertisement Quote: Original post by tmack Quote:  Original post by The Reindeer EffectI'm sorry, how does this differ from native code? You cannot decompile native code to the original source code. You cannot decompile MSIL to the original source code. Despite whatever you're thinking, MSIL and machine code are (for the most part) the same thing. MSIL may be a bit easier to decompile considering the way it's built (you may get easy access to what type a variable is, you still won't get any meaningful variable names or any of that stuff), but it's essentially the same as machine code. You're missing the point here. Code is compiled to make it something the computer can understand. It was never about 'protecting' source code. And no, you do not get the original source from decompiling MSIL. Quote:  Original post by tmackAnswer this- Why does .NET convert to MSIL? To make .NET PORTABLE? If this is true- what if I do NOT want my application to be portable? Why am I forced to make it portable? .NET compiles to MSIL. That's the way it is. It's designed to be easily portable, yes. If you don't want to make your application portable, don't use a .NET language. Nobody is forcing you to use .NET. #### Share this post ##### Link to post ##### Share on other sites Now that I think about it, I recommend that you develop in C++ because it is faster, smarter, and better looking than C#. It will protect your intellectual property and prevent your software from being hacked, cracked, or whatever the lingo is nowadays. You will gain the respect of others as you dazzle them with your valuable accomplishments, and you can sleep at night knowing that C++ is keeping you safe. C++ is also cheaper and easier to use, because you don't have to deal with figuring out how to break your application from of the bondage of .NET. #### Share this post ##### Link to post ##### Share on other sites Quote:  Original post by The Reindeer EffectNow that I think about it, I recommend that you develop in C++ because it is faster, smarter, and better looking than C#. C++ is faster then C# for a fact. I take it you don't know C++, do you? Quote:  It will protect your intellectual property and prevent your software from being hacked, cracked, or whatever the lingo is nowadays. You will gain the respect of others as you dazzle them with your valuable accomplishments, and you can sleep at night knowing that C++ is keeping you safe. I never said any of that. You do NOT need to get smart with me. My point is C# is NOT COMPILED MACHINE READABLE CODE! It has to be translated to MACHINE CODE BEFORE IT IS RAN. Why must you make smart comments like that? Quote:  C++ is also cheaper and easier to use, because you don't have to deal with figuring out how to break your application out of the bondage of .NET. I know enough C++ to use the Windows API. I've done it before. I felt I wanted to try C#, so I went for it. Now I know why I stayed with it. If you must make immature comments please do not respond. My time is very tight, so please don't waste it by making me respond to your posts. Thanks :) #### Share this post ##### Link to post ##### Share on other sites Quote: Original post by tmack Quote:  Original post by Anonymous PosterNo. C# is not C++. You are, frankly, mad if you think you can get all the features of .NET (no, not just 'C#', .NET in general) and still compile to machine code.No offense, but your argument is pathetic - you keep reiterating the same point over and over again, and I believe it is starting to grate on our nerves. We already debunked your rationale for this, so there's very little being argumentative about the issue can accomplish for you.So, to answer your question: no, you cannot compile C# straight down to machine code. It requires the .NET runtime much in the same way that Java requires the JRE. ;) You are wrong. There is a way to do it. If you want to spend lots of money. http://www.remotesoft.com/salamander/protector.html. I'm not spending$1899 for a peice of software that does what a C++ compiler does (that you can get for free).

Excellent, except that all Salamander does is package the .NET runtime together with the executable and short-circuits the process. Its still .NET under the hood, and that means MSIL.

Amazing what research does to a man.

##### Share on other sites
You know what? I'm sorry. That was completely uncalled for.

I'm stepping out of this conversation because anything useful to people wondering about .NET and the ability to perform source code analysis on competing products has already been discussed to death. Its done its job.

Good fight, good night!

##### Share on other sites
Quote:
 Original post by tmackC++ is faster then C# for a fact.I take it you don't know C++, do you?

Yes, I specifically mentioned that C++ is faster than C#. I do know C++, but even knowing C++ isnt required to arrive at overextended performance assumptions based on microbenchmarks.

Quote:
 My point is C# is NOT COMPILED MACHINE READABLE CODE! It has to be translated to MACHINE CODE BEFORE IT IS RAN. Why must you make smart comments like that?

This depends upon your definition of machine. But yes, I will agree, I have never seen a machine that runs C# code without compiling. Nor have I seen one that runs C++ code without compiling, for that matter. But I will let you in on some startling information that may very well ruin your day: Your CPU is an interpreter, when you distribute a binary you are distributing source code.

Quote:
 If you must make immature comments please do not respond. My time is very tight, so please don't waste it by making me respond to your posts. Thanks :)

It's like an onion, and its only a waste of your time if you don't peel past the outer layer. But keep peeling, and when you start crying you will know that you have reached the good stuff.

##### Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
Original post by tmack
Quote:
 Original post by Anonymous PosterNo. C# is not C++. You are, frankly, mad if you think you can get all the features of .NET (no, not just 'C#', .NET in general) and still compile to machine code.No offense, but your argument is pathetic - you keep reiterating the same point over and over again, and I believe it is starting to grate on our nerves. We already debunked your rationale for this, so there's very little being argumentative about the issue can accomplish for you.So, to answer your question: no, you cannot compile C# straight down to machine code. It requires the .NET runtime much in the same way that Java requires the JRE. ;)

You are wrong. There is a way to do it. If you want to spend lots of money.

http://www.remotesoft.com/salamander/protector.html.

I'm not spending $1899 for a peice of software that does what a C++ compiler does (that you can get for free). Excellent, except that all Salamander does is package the .NET runtime together with the executable and short-circuits the process. Its still .NET under the hood, and that means MSIL. Amazing what research does to a man. Amazing what reading does to a man: Code Protection screenshot The protector shuts down disassembly and decompilation rather than simply obfuscating code. Because the protector encrypts and replaces MSIL code with native code, Microsoft .NET Framework-based assemblies cannot be decompiled back to high-level source code. This is impossible for an obfuscator to achieve since the output of any obfuscator is still MSIL code. Before: IL_0000: ldstr "Hello World using C#!" IL_0005: call void [mscorlib]System.Console::WriteLine(string) IL_00a: ret After: 00000000 mov eax,dword ptr ds:[20004000h] 00000006 mov ecx,dword ptr [eax] 00000008 mov eax,dword ptr ds:[200046C0h] 0000000e call dword ptr [eax] 00000020 ret I can understand many people misunderstood what I'm getting at... All I needed to know if there was other programs, possibly free, or cheaper ($100 or so) that can do what Salamanders .NET Protector does.

I'm away that programming in C++ is not safe, but you can not decompile c++ back to a high level language. The most you get is the little bit of assembly. I'm not worried about people seeing the assembly. I'm worried about people finding the source code to the algorithms I make for my game engine (such as map formats, etc).. which would allow them to learn how to convert a cached level into a real map and use the level editor to steal somebodies NPC scripts, etc.

I'm sorry for the confusion, I appologize to anyone who felt I was rude. I will continue to research this topic on google.

##### Share on other sites
Quote:
Original post by Ra
Quote:
Original post by tmack
Quote:
 Original post by The Reindeer EffectI'm sorry, how does this differ from native code?

You cannot decompile native code to the original source code.

You cannot decompile MSIL to the original source code.

Despite whatever you're thinking, MSIL and machine code are (for the most part) the same thing. MSIL may be a bit easier to decompile considering the way it's built (you may get easy access to what type a variable is, you still won't get any meaningful variable names or any of that stuff), but it's essentially the same as machine code.

You're missing the point here. Code is compiled to make it something the computer can understand. It was never about 'protecting' source code.

I am aware of this, but what I'm saying is you can physically DECOMPILE C# back to any high level language. At least if it is compiled to machine code it has *some protection*.. Meaning, you cannot decompile machine code, the code that THE PROCESSOR CAN UNDERSTAND, back to a human-readable high level language.
Quote:
 And no, you do not get the original source from decompiling MSIL.

http://www.remotesoft.com/salamander/

Put in any of your favorite applications. Try a search for .NET Reflector, also. While you're googlin', try searching for ".NET Decompilers". It's very, very, very possible :)
Quote:

Quote:
 Original post by tmackAnswer this- Why does .NET convert to MSIL? To make .NET PORTABLE? If this is true- what if I do NOT want my application to be portable? Why am I forced to make it portable?

.NET compiles to MSIL. That's the way it is. It's designed to be easily portable, yes.

If you don't want to make your application portable, don't use a .NET language. Nobody is forcing you to use .NET.

But see, .NET is so easy to use. I love Microsoft Visual C# 2003's GUI, and the VB6-like form designer. I just want it compiled to native code rather then MSIL :(!!

Anyway, it was a good argument guys.. I enjoyed it.. it was fun. Appologizes if I was a bit rude or anything to anyone.

##### Share on other sites
Yet another person living under the delusion that someone actually would bother to rip off his code.

##### Share on other sites

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

This topic is now closed to further replies.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 19
• 12
• 13
• 17
• 13
• ### Forum Statistics

• Total Topics
634466
• Total Posts
3017639
×