CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    [RESOLVED] .Net to native?

    I am a beginner in C# but I have many years of experience in programming for Windows (mainly Delphi). After successfully running my first C# program (using images, sound, file IO) I can see the advantages of .Net programming. But there is a huge drawback that I cannot just brush away.

    Here is my problem: .Net executables are easy to decompile; I have decompiled my code using software that I got off the Web. Moreover, I couldn't find a utility to compile .Net code to native executables on Windows (there may be options on Linux). Since I (also) do non-open-source software development, I wouldn't consider moving to C#/.Net unless there was an option for me to convert my .Net CIL code to native code. The ngen.exe utility that comes with the .Net framework doesn't seem to be an option.

    How do you compile your .Net code to native code? I doubt all .Net programmers open-source their applications. Those who are tempted to ask "Why do you want to hide your code?" please abstain.

    Thank you.
    Last edited by tr00don; April 1st, 2009 at 09:44 AM.

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: .Net to native?

    Shortly: you cannot. It is the way which .NET was designed, that every assembly contains metadata which allows anybody simply reflect the code.

    You can make the compiled code human unreadable with obfuscator (see here).
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  3. #3
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: .Net to native?

    Thank you. According to that web site, obfuscation does not fully protect the code against reverse-engineering. It is ironic that a company such as Microsoft, who put so much emphasis on IP protection and patents, would want every developer to publish readable code.

    I think there will be two classes of code, eventually: native/commercial and .Net/open-source. The former will need a digital certificate or some other mechanism to run (hint!) while the latter will be open to "inspection" by the .Net parser... and everybody else, for that matter.

    Unless open-source developers figure out how to convert .Net code to native code.

    Update: I guess I was right on the money, so to speak: "Games for the Wii and iPhone would need to statically link the Mono runtimes, invoking the need for a commercial license." (http://www.desktoplinux.com/articles/AT7746284247.html). There are already AOT-compiled Mono games running on the iPhone (http://arstechnica.com/open-source/n...ne-and-wii.ars) and the dev tools license cost $1400+ (http://unity3d.com). If Novell and others can do it then Microsoft can do it. Well, that means in the future developers will have to pay both for the dev tools and for their apps to run in "Intelectual Property-protected"-mode on client's machines.
    Last edited by tr00don; April 1st, 2009 at 11:15 AM.

  4. #4
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: .Net to native?

    This is probably the biggest draw back for developing in .Net. This is the main reason you don't see many commercial apps that are build with .Net.

    It's not that big of a deal for me right now, since I work for a company that does custom software for clients. So it's not that big of a deal for somebody to reflect my code to look at it.

  5. #5
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: .Net to native?

    I tend to disagree with Post # 3 & 4. The world of computing has changed and any new applications that are built are built as SaaS which means you don't give an application to the user, rather you just provide the application as a service.

    How many of us know that any Java application can be reverse engineered same way the .NET code is?

  6. #6
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: .Net to native?

    Quote Originally Posted by Shuja Ali View Post
    any new applications that are built are built as SaaS which means you don't give an application to the user, rather you just provide the application as a service.
    That is well said from the perspective of a server software developer who works for a SaaS provider. What if you are a contractor? Additionally, some of us are mainly desktop software developers. How about the mobile market, particularly games? Some apps must run on your machine.
    Last edited by tr00don; April 1st, 2009 at 01:38 PM.

  7. #7
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: .Net to native?

    Quote Originally Posted by tr00don View Post
    That is well said from the perspective of a server software developer working for the service provider. What is your client wants to run it off their servers? Additionally, some of us are mainly desktop software developers. How about the mobile market, particularly games? Some apps must run on your machine.
    That is the reason you have Obfuscators around. There are third-party obfuscators that are pretty good. Some of the managed code that microsoft writes is obfuscated too, but i really don't know what tool or technology do they use.

    Also Visual Studio ships with a community edition Obfuscator, but i have never used it.

    Did you explore Ngen.exe, don't know how useful it will be to you.

  8. #8
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: .Net to native?

    Quote Originally Posted by Shuja Ali View Post
    That is the reason you have Obfuscators around.

    Did you explore Ngen.exe, don't know how useful it will be to you.
    Obfuscated software can still be decompiled.

    Regarding ngen.exe, according to this: http://msdn.microsoft.com/en-us/library/ms973839.aspx :

    "If you run ngen.exe before you ship the program, you limit the optimizations to the ones available on your machine."

    How I read it: ngen.exe generates code that may or may not run on other machines.
    Last edited by tr00don; April 1st, 2009 at 01:58 PM.

  9. #9
    Join Date
    May 2007
    Posts
    1,546

    Re: .Net to native?

    Native code can be decompiled. Nothing can stop a determined person, take DRM as a prime example. If you're that worried about someone decompiling your software, the best you can really do is just obfusticate it. It makes it that little bit harder which would deter the casual person.

    This is the main reason you don't see many commercial apps that are build with .Net.
    Heh, I think i'd rapidly run out of numbers if I tried to count the number of commercial tools/apps built using .NET
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  10. #10
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: .Net to native?

    Quote Originally Posted by Mutant_Fruit View Post
    Native code can be decompiled.
    Yes, but only to Assembler. Good luck with reverse-engineering that.

  11. #11
    Join Date
    Jun 2008
    Posts
    2,477

    Re: .Net to native?

    Quote Originally Posted by eclipsed4utoo View Post
    This is probably the biggest draw back for developing in .Net. This is the main reason you don't see many commercial apps that are build with .Net.
    Huh? I don't know where you are looking, but C# is currently the 7th most popular language out there. What exactly are all of these people doing with it if not building commercial .NET apps? I know that it is popular for internal stuff as well, but internal apps alone do not take you to #7.

  12. #12
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: .Net to native?

    Quote Originally Posted by BigEd781 View Post
    Yes, but the fine print reads: "The ratings are based on the number of skilled engineers world-wide, courses and third party vendors." It doesn't count the actual number of .Net application out there. Besides, I think our friend meant .Net desktop aplications.

  13. #13
    Join Date
    Jun 2008
    Posts
    2,477

    Re: .Net to native?

    Quote Originally Posted by tr00don View Post
    Yes, but the fine print reads: "The ratings are based on the number of skilled engineers world-wide, courses and third party vendors." It doesn't count the actual number of .Net application out there. Besides, I think our friend meant .Net desktop aplications.
    Well, it's not very practical (or possible) to count every app out there. Do you think the stock market index works by averaging the value of every public company out there? No, it uses an index for approximation.

  14. #14
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: .Net to native?

    I know we can decompile VB 6 Code too. That one was compiled to native code too.

    The thing is that if some one is hell bent to decompile something, there are tools available to do that. Part of .Net framework can be decompiled, but I don' see Microsoft being worried about that. And there are other number of applications that are built on top of .Net framework that are shipped today too and I don't see the ISVs being worried about decompilation.

  15. #15
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: .Net to native?

    Quote Originally Posted by BigEd781 View Post
    Huh? I don't know where you are looking, but C# is currently the 7th most popular language out there. What exactly are all of these people doing with it if not building commercial .NET apps? I know that it is popular for internal stuff as well, but internal apps alone do not take you to #7.
    I would like to see a list of known commercially available applications that were written in .Net that I can buy right now for my PC. Maybe just a few, not a whole list(I don't exactly know how to search google for this).

    I don't mean niche market applications that a guy in his room created and is selling. I mean applications that are built and sold by medium to large size companies.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured