7

In an open-source software project, GPL2 or 3, is it legal to use code snippets from Microsoft Knowledge Base articles - the ones that used to be called something like Q1234567, nowadays called just by the number, say 1234567?

2 Answers 2

9

Let me take a practical example with this article on How to recursively search directories by using Visual C# that contains some sizeable code snippets. Is there any indication of what I can do with its code snippets?

At the bottom of the article there is an explicit copyright notice © 2016 Microsoft and a link to Terms of Use (TOU). In particular the section "Personal and Non-Commercial Use Limitation" states:

Unless otherwise specified, the Services are for your personal and non-commercial use. You may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information, software, products or services obtained from the Services.

I could not find anything else that would specify otherwise in the TOU or the article. Therefore I cannot do much if anything: these terms are conflicting with most open source and proprietary licenses in general and the GPL in particular.

On the TOU page, the "Intellectual Property" menu bar has a link to another Copyrights/Permission page that essentially restates the same thing.

So for KB articles, the answer is: No, I cannot reuse code snippets for inclusion with any software: only some personal limited use is kind of allowed.

In contrast, the MSDN web site TOU are different and called "Microsoft Developer Services Agreement". They have an explicit open source license grants for code samples:

Exhibit B

Microsoft Limited Public License

This license governs use of code marked as “sample” or “example” available on this web site without a license agreement, as provided under the section above titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use such code (the “software”), you accept this license. If you do not accept the license, do not use the software.

So I may be able to reuse MSDN code samples under this license... but this license is not a true free or open source license because of some restriction and probably other terms:

(F) Platform Limitation - The licenses granted in sections 2(A) and 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.

The license only applies to Windows-based software so it is as bad as a proprietary agreement for use in any open source-licensed software.

Would the answer here change in any way if the said article were an old one, no longer updated by Microsoft, as in "This article has been archived. It is offered "as is" and will no longer be updated"?

Let's again take a concrete example with this article:

This article has been archived. It is offered "as is" and will no longer be updated.

The fact it is no longer updated has no impact for now until the copyright expires in a 100 years or so e.g. 50 to 70 years after the author (Microsoft? or one of its employees?) dies... :

In most countries, the duration of copyright is dependent on the duration of the author's life. After he dies, his estate can exercise the copyright for at least 50 more years. In most countries, the term is even longer: 70 years after the author's death.

So this statement has no practical impact for the time being. If I feel very strongly about this code snippet I could contact Microsoft to ask them for different license terms. Good luck!

2
  • Would the answer here change in any way if the said article were an old one, no longer updated by Microsoft, as in "This article has been archived. It is offered "as is" and will no longer be updated"?
    – Hrach
    Nov 30, 2016 at 22:55
  • @Hrach not at all. Dec 26, 2016 at 12:47
4

Very short snippet (especially if you modify it, to prove that you copied the idea not a code that you don't understand) and idea are not copyright-able, so you can reuse it.

But for larger code, you cannot use the code (see the other answer).

Note: once you find the solution, you can look for other sites which use similar code (on non Microsoft sites, with better licenses), or just apply the idea you just learned (maybe after a day, without looking again the original site).

5
  • "maybe after a day without looking" that sounds hard to document. Nov 29, 2016 at 17:58
  • right, but it should be enough to rewrite the code non-verbatim. Nov 29, 2016 at 19:09
  • is it really sane to recommend such an approach? Google and Oracle have battled in courts over 9 lines of code afaicr... Nov 30, 2016 at 6:42
  • @PhilippeOmbredanne: I have no photographic memory, so for me the code I wrote the next day will be really based on ideas. Oracle vs. Google is really different.It is not about ideas but about API (so it had to be "copied" verbatim), and the discussion there was about copyright to restrict interoperability and API. I think nobody make cases about ideas. Dec 2, 2016 at 8:25
  • I think that whoever down-voted this answer was wrong doing so. Some may consider it bad advice but what it says is clearly true. Ideas and algorithms are not copyrightable (maybe they are patentable but that is another issue).
    – Zimm i48
    Dec 2, 2016 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.