views:

170

answers:

4

Is it legal / ethical to copy code for any reason, or utilize it (like code review) from the

  • .Net framework

    or

  • any other .Net based API

    using Reflector or similar tools ?

If it is, what advantages do Microsoft and other licence based softwares have for packing there code ?

If it is not, Why can we use ILDasm and Reflector ?

Another way of saying this is Why to pack it up if it is fine to review it ?

probably I am missing some bits in the question, any one who feels, could ask this question in a better way, is most welcome to edit.

Thanks

+1  A: 

If using the code for code reviews or to see how a product accomplishes something, I would guess it's a legal grey area but you'd obviously want to consule an actual lawyer to confirm that. I personally don't see any ethical issues reviewing code through reflector but I could see where people would have a big problem with it.

If the code gained by reflector is used in a product then I am pretty sure that would be illegal (again, consult a lawyer) and is obviously unethical.

I've used reflector before a couple of times to review code from 3rd party libraries when I've found bugs in order to let them know how the code is broken and what to do to fix it. Each time the company has been receptive so I'm guessing they either didn't realize how I found and advised fixing the bug or didn't care.

Brian Hasden
A: 

I suspect the legal answer will depend on how you licensed the code (and on how big your lawyers are, how big the other guy's lawyers are, and where you're both located).

I bet that, somewhere in some EULA, it specifies exactly what you can and can't do with the .NET Framework. Presumably it's OK to disassemble it to look at it -- otherwise, why would they give you ILDasm.exe in the SDK? -- but I strongly doubt that you can get away with cutting-and-pasting the results into your own code.

IANAL, obviously. And I have no intention of digging through the Microsoft EULAs to check my answer, either ;-)

Matt Bishop
If all above is enough to specify rights and protect there code, why do they pack it and then let us use ILDasm or Reflector
Asad Butt
All compiled code can be disassembled. They don't "let" you do it -- they can't physically stop you. They can only attempt to discourage you, by applying licenses, lawyers, social pressure, and so on. Whether that discouragement will work is a matter for you and your conscience, I guess.
Matt Bishop
That is the point, First it is shipped as binaries and executables, then they also let us do it by shipping ILDasm like tools. then there IS EULA, lawyers and so on. It seems to be a very thin line between what is legal and what not..
Asad Butt
There's nothing particularly special about the presense of .NET Reflector that makes it OK to disassemble binaries you get. Just because Reflector gives you something that looks like source code doesn't change the fact that the DLL is still a binary, and .NET Reflector is still a disassembler, and you probably agreed not to disassemble the code when you accepted the EULA.
Yuliy
+1  A: 

A lot of EULAs explicitly state that it is not legal to disassemble their code. ILDasm is a tool provided by Microsoft for working with the framework. If you know nothing about IL debugging, let's just say it's an invaluable tool for working with your own code.

However, due to the nature of .NET code being compiled to IL and the widespread availability of this disassembler, it becomes possible to disassemble code that you have not personally written. Obfuscators can make this more difficult, but protecting your code by specifying no disassembly in the EULAis usually enough for most companies. If the EULA states no disassembly, then technically it's illegal for you to use ILDasm.exe on the code. Just because you are ABLE do something, doesn't mean you CAN or SHOULD do it.

At any rate, it's pretty safe to assume that any "licensed" software should not be disassembled, and it's almost certainly NOT legal to use code from that library elsewhere.

Long story short: Don't do something just because you can. Make sure it's permitted first.

Chris
A: 

To quote your comment...'Why do they pack it and let us use ILDasm or Reflector?' makes me wonder...There are laws in place, there are protection in place, sure you can use Reflector, iLDasm but that does not mean you have the right to rip out the code and pass it off as your own, or copy it and paste it into your own code.

That's what the EULA and lawyers are there for!!

That is the nature of the .NET world of executables where assemblies are easily viewable.

Big companies who are marketing their .NET product would be none the wiser and would go to great lengths to obfuscate and to protect their revenue, which brings us back to the comment you made in answer to Matt Bishop's answer to your question...

I get the impression you don't respect other people's work and tread a very thin line on regards to the ethics of the software industry, in terms of protection, copyright, EULA's...

Sorry to be sounding harsh and blunt but why post the question in the first place?

Hope this helps, Best regards, Tom.

tommieb75
@tommieb75: thanks for your response. probably I was not clear. I never said, I / we should use / copy code . Qeustion is still there.Why to pack and then provide unpacking tools ?
Asad Butt
What's the difference between Java and .NET? Both have a virtual machine, the code are compiled to a byte level code which is JITted at run-time. The SDK tools, by their nature, has the ability to peer inside the binaries for the purpose of debugging and learning. Hence the byte level code are easily disassembled and viewed. But regardless, it is still an executable and the EULA is designed to protect it.
tommieb75