Would creating software that functions in a similar way to existing software be illegal? If I create software that is similar to other software, would I break the law? I mean not exactly the same, there would be many differences; let's say I'm going to create a blog platform, and there are already many others. The software would be free and open source. When would creating software that has similar functionality to other software infringe the law?
The software being free and open source has no impact on whether it infringes any patents or violates any copyrights. Copyrights attach to fixed representations of creative work in a tangible medium (e.g., the actual code and graphical elements of the software in question). As long as you aren't copying the copyrighted work of someone else, you should be in the clear. So, if you write your own code from scratch, or rely on code that you're allowed to use (e.g., "free" software with a permissive license that allows it to be used freely), you should be fine. On the other hand, if you copy a chunk of code that you aren't allowed to use, and then change the variable names so that it's superficially different, you're likely violating someone's copyright. Patents are a much more difficult question. To determine whether you would infringe any patents, you would have to read the independent claims of every patent that might be related. If you perform all the steps of any one of those claims, then you are infringing that claim (and therefore, the patent in which it is found). Unfortunately, this is much easier said than done. First, it may be difficult to search for all the potentially relevant patents, and once you've found them, there may be far too many to read. Second, claims are written in a type of language that is specific to patents, and someone without experience in patent law may not understand them correctly. Finally, the terms in the claims may not take on their plain English meaning, but rather may have been defined by the language in the rest of that patent, so it's possible that you might incorrectly think you were in the clear based on a misunderstanding arising from that. All that said, it may be best to go ahead with implementing an idea and then waiting to see what happens. Chances are that the implementation will arguably infringe some patent in some way, no matter what's done. But chances are also high that there will never be any worrisome enforcement action taken against it by a patent owner, simply due to the difficulty and expense associated with enforcing patent rights.
"Doing the same thing" is very common. We even have names for certain categories of websites, such as "web shop" and "blog". Such concepts are not protected in general. Obviously, you can't copy the name of existing webshop, or their logo, but things like a "rectangular layout of products for sale" aren't original. There is of course a grey area here, because there's a continuum of similarity. In general, similarities that follow from technical justifications are acceptable (having an upload button is sort of the point for your website), similarities that are cosmetic only (same color choice) might be interpreted as intentional attempts to cause confusion.
A fundamental principle of copyright law is that protection is only afforded to the concrete expression, and not the abstract idea. Therefore, if you write a sort program, what is protected is &quot;that specific program&quot;, and not the general idea of a sort program. There are many kinds of sort algorithms: if you write a bubble sort program, you don't &quot;own&quot; all bubble sort programs, you only own the one that you wrote. If you sell your right to a particular bubble sort program, you don't thereby prevent yourself from writing another bubble sort program. But, technically, you do prevent yourself from copying that program, changing some variable names or maybe manually recoding a couple of lines, and re-licensing the code (assuming that you fully transferred copyright, or gave the customer exclusive rights to the code). The basic question that the courts will ask is &quot;did you copy that program&quot;, which they answer by looking at the similarity between the two programs. All bubble sorts have a necessary similarity. To prove infringement, the plaintiff would (ultimately) have to prove that the similarity had to have come from copying rather than independent coincidental re-creation. Functional considerations and general programmer practice would tend to weigh against an allegation of infringement in certain cases, where &quot;counter&quot; is a common name for a counter variable, and bubble sort is a well known algorithm with limited practical differences in lines of code. The hard part is establishing that it would be natural for such similarities to exist even when independently coded by a single person. It may be common practice to take a program that you've sold and tweak it in some fashion, but that is copyright infringement, whereas &quot;applying the lessons that you learned in writing X to a new program&quot; is not infringement, it is using the same ideas, and the ideas are not what is protected.
Company B has created a derived work from company A's copyright-protected work, so yes, B has infringed on A's copyright. It might be difficult for A to prove it, however, so B might get away with it, but it's still infringement. On the other hand, if B creates software that behaves like A's through reverse engineering, that is, by examining the program's function without examining its code, then they will not have infringed the copyright in the code.
You are suggesting strict liability for software bugs. You haven't tried to show any negligence or incompetence on Microsoft's part, but just appear to have assumed that the existence of a bug that causes harm should create liability. Strict liability is rare, at least in the US, and does not in general apply to software. Given strict adherence to the best practice in developing software, there will be bugs, so a bug is not itself evidence of any sort of wrongdoing on Microsoft's part. In real life, if there was strict liability for software bugs, nobody and no business would write software for the use of others, because of the ever-present potential of being wiped out by lawsuits despite all they could do.
It doesn't work like that! If the code is not properly licensed, you can not acquire a license for it. If you don't have a license, you can not use it. Usage without a license is copyright infringement and not allowed: the copyright is with the author, and only the author may make derivates or copies or allow them to be made by licensing it. You do not gain copyright by fixing a licensing error - in fact, you commit copyright infringement if you do not have a license, and providing wrong copyright management information is illegal under 17 USC 1202
What you're talking about is called black-box reverse engineering. It can be done, and as long as you are meticulous in your record keeping the fact that it has been done should be an appropriate defence against copyright infringement. But that doesn't help against patent claims - while in copyright cases the fact that code has or has not been directly copied is critical, in patent cases it its irrelevant: if you use a patented method, it's a violation. You therefore will need to be careful about any patents that may have been issued to the original author, as well as avoiding copying.
It's a contract violation if you're under the EULA. It may be a contract of adhesion, but such "clickwrap" contracts been found to be acceptable and enforceable in software EULAs out of necessity. However, there may be some limits. If you're not under the EULA, as you argue, then you lack a license to use the software at all and it's an outright copyright violation and/or a theft or misappropriation of the software. Whether or not you can be sued depends in part on what you do with it — if you don't release the material or otherwise cause damages then there's not much to sue for... Added for clarification: to answer the framing question, supposing neither contract or copyright applied, one could be sued in tort or in equity (i.e. for unjust enrichment).