如何检测 Windows 版本是否合法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1458896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to detect if a Windows version is legal or not?
提问by Wim ten Brink
I'm not interested in getting version information. All I want to do is to make sure my application will only run on a legal version of Windows and not on a pirated version. Windows uses some trick to determine this but still allows pirated versions to continue to run, although with some limits.
我对获取版本信息不感兴趣。我想要做的就是确保我的应用程序只能在合法版本的 Windows 上运行,而不是在盗版版本上运行。Windows 使用一些技巧来确定这一点,但仍然允许盗版版本继续运行,尽管有一些限制。
So, is there a way to check if the application is installed on a legal, genuine Windows version? (Vista and better, at least.)
那么,有没有办法检查应用程序是否安装在合法、正版的 Windows 版本上?(至少,Vista 和更好的。)
Let me clear something up: Microsoft isn't preventing users to use a non-validated or illegal version of their operating system. Thus I don't have any reasons to block my application on such a version either. But I do want my application to be aware of the illegal version and warn the user that his Windows version isn't validated. Maybe he forgot, maybe he doesn't want to validate. There could be plenty of reasons for this and I don't want to block them, just making them aware of a problem with their Windows version.
让我澄清一下:微软并没有阻止用户使用未经验证或非法版本的操作系统。因此,我也没有任何理由在这样的版本上阻止我的应用程序。但我确实希望我的应用程序知道非法版本并警告用户他的 Windows 版本未经过验证。也许他忘记了,也许他不想验证。这可能有很多原因,我不想阻止他们,只是让他们意识到他们的 Windows 版本存在问题。
Also, when someone uses a non-valid version of Windows then I might want to do a more strict validation check of my own software, if it's a commercial product. In my free products, I just want an annoying popup, which will just appear once per day.
此外,当有人使用无效版本的 Windows 时,我可能想要对我自己的软件进行更严格的验证检查,如果它是商业产品。在我的免费产品中,我只想要一个烦人的弹出窗口,每天只会出现一次。
The main problem with non-validated Windows versions is that they might contain additional spyware and other malware and there's a chance that they don't get all required updates. These Windows versions have a weaker protection than validated Windows versions. Since several of my applications use sensitive data, I don't want any malware leaking away this sensitive data.
未经验证的 Windows 版本的主要问题是它们可能包含额外的间谍软件和其他恶意软件,并且有可能无法获得所有必需的更新。这些 Windows 版本的保护比经过验证的 Windows 版本弱。由于我的几个应用程序使用敏感数据,我不希望任何恶意软件泄露这些敏感数据。
Plus, I consider pirated software harmful for any free alternatives. Linux and FreeBSD would have been much more popular if it wasn't for all those pirated Windows versions that are roaming around. People who use pirated software are unlikely to have bought the product in the first place but I would prefer them to use a free alternative instead. Pirated software does a little harm to Microsoft, but it does a lot more harm to the Free community since it keeps people connected to those commercial products...
另外,我认为盗版软件对任何免费替代品都是有害的。如果不是所有那些四处游荡的盗版 Windows 版本,Linux 和 FreeBSD 会更受欢迎。使用盗版软件的人不太可能首先购买该产品,但我更希望他们使用免费的替代品。盗版软件对微软有一点伤害,但对免费社区的伤害更大,因为它让人们与那些商业产品保持联系......
采纳答案by cletus
Not even Microsoft can do this reliably. It is a constant arms race as Microsoft updates WGA against people who seemingly have to do very little to bypass it. This is exacerbated by the needs of OEMs who (rightly) need to have preinstalled and prevalidated copies of OSs so they don't annoy their customers, whom may well be business customers. I thinkthat a lot of the "hacks" around this have to do with OEM master keys.
甚至 Microsoft 也无法可靠地做到这一点。这是一场持续的军备竞赛,因为微软更新 WGA 以对抗那些似乎几乎不需要做任何事情就可以绕过它的人。OEM 的需求加剧了这种情况,他们(理所当然地)需要预先安装和预先验证操作系统的副本,这样他们就不会惹恼他们的客户,而这些客户很可能是商业客户。我认为围绕这一点的很多“技巧”都与 OEM 主密钥有关。
Basically, pirating software (including Windows and your software) is a social problem not a technical one. The worst thing you can do as a software vendor (imho) is to annoy your legitimate customers in the quest to stop pirates to the point that you make your legitimate customers pirates. Example: some games have gone so far as to install rootkits as well as limiting the number of activations (eg Spore).
基本上,盗版软件(包括 Windows 和您的软件)是一个社会问题而不是技术问题。作为软件供应商(恕我直言),您可以做的最糟糕的事情是激怒您的合法客户,以阻止盗版,以至于您使合法客户成为盗版。示例:某些游戏甚至安装了rootkit 并限制了激活次数(例如Spore)。
Limiting activations in particular is an evil practice. People have an innate sense of fairness about these things. If they have two activations of something, are running Windows XP and switch to Windows 7 RC and will then switch to a real version of Windows 7 when released then they've just gone over the limit. As in the case of Spore, you can request additional activations over the phone but this kind of thing just rubs people the wrong way. Some to the point that they'll feel quite justified in bypassing such restrictions.
特别是限制激活是一种邪恶的做法。人们对这些事情有一种与生俱来的公平感。如果他们有两次激活,正在运行 Windows XP 并切换到 Windows 7 RC,然后在发布时切换到 Windows 7 的真实版本,那么他们刚刚超过了限制。与 Spore 的情况一样,您可以通过电话请求额外的激活,但这种事情只会以错误的方式打扰人们。有些人会觉得绕过这些限制是合理的。
As for downvoting your question, I suspect it's because people don't like your intent, probably for reasons that are similar to the ones I've listed above.
至于否决您的问题,我怀疑这是因为人们不喜欢您的意图,可能原因与我上面列出的原因类似。
回答by
It's an interesting question but wrong attitude. It is not your business checking the affairs of the user.
这是一个有趣的问题,但态度错误。检查用户的事务不是你的事。
Or you might as well:
或者你也可以:
Require their tax declaration before selling your software to them
A written proof from police they have no criminal record (or they may be inclined to break the law again and pirate your software)
Check if they have any torrent software installed (of course it can be used legally but the very fact they have it implies they may misuse it)
Check if they have antivirus software installed (to raise their social awareness and to help fight spam bot networks)
A credit history report (to be sure they have promptly paid their bills and will also not forget to pay for your software)
A proof from their family doctor they have no terminal disease (a person feeling condemned may break the law and pirate your software)
在向他们出售您的软件之前要求他们进行纳税申报
警方的书面证明,他们没有犯罪记录(或者他们可能会再次违法并盗版您的软件)
检查他们是否安装了任何洪流软件(当然它可以合法使用,但他们拥有它的事实意味着他们可能会滥用它)
检查他们是否安装了防病毒软件(以提高他们的社会意识并帮助打击垃圾邮件机器人网络)
信用历史报告(确保他们已及时支付账单并且不会忘记为您的软件付款)
来自他们的家庭医生的证明他们没有绝症(感觉受到谴责的人可能会违法并盗版您的软件)
You see where it's going right?
你看到它去哪里了吗?
One of the key rules for developing software - your software should be useful, make the users happy and build as few barriers as possible.
开发软件的关键规则之一——你的软件应该是有用的,让用户开心并尽可能少地建立障碍。
回答by Kristof Provost
You can't possibly know and you shouldn't care.
你不可能知道,也不应该在意。
The legal status of an install is entirely unrelated to anything on the disk. The same install can be unlicensed now and licensed the next minute without any changes to the machine.
安装的合法状态与磁盘上的任何内容完全无关。相同的安装现在可以取消许可,并在下一分钟获得许可,而无需对机器进行任何更改。
回答by wefwfwefwe
That's something for Microsoft to worry about. Not you.
这是微软需要担心的事情。不是你。
回答by Frank Bollack
Microsof offers a small API, but MSDN doesn't state anything about how the used DLL is installed at the client system. My guess is, that it comes with the SP2 or WGA utility from windows Update.
Microsof 提供了一个小的 API,但 MSDN 没有说明如何在客户端系统上安装所使用的 DLL。我的猜测是,它带有来自 Windows Update 的 SP2 或 WGA 实用程序。
This is the MSDN pagefor the API.
这是API的MSDN 页面。
回答by HalliHax
Why don't you also check to make sure they're not running a pirated version of Photoshop? Or Half-Life? How about Microsoft Office?
你为什么不也检查一下以确保他们没有运行盗版的 Photoshop?还是半条命?微软Office怎么样?
See where I'm going with this? I don't particularly agree with piracy checks as it stands - but in order to perhaps save you a headache, I would suggest that you only worry about whether your own software is pirated, using whatever means you wish (licence keys, phoning home, whatever nefarious and intrusive method you so desire!). So someone who pirated Windows MAY be likely to also pirate your software too. If you intend to block usage of your software if you detect they're running a pirated copy of Windows - well, that's just bad practice. What if the validation software is buggy, or incorrect, or reports that the software is pirated because SOMEBODY ELSE used this person's legitimately bought licence key?
看看我要做什么?我并不特别同意目前的盗版检查 - 但为了让您免于头疼,我建议您只担心自己的软件是否被盗版,使用您希望的任何方式(许可证密钥,打电话回家,无论您想要什么邪恶和侵入性的方法!)。因此,盗版 Windows 的人也可能也盗版您的软件。如果您打算在检测到您的软件运行的是盗版 Windows 副本时阻止其使用 - 好吧,这只是不好的做法。如果验证软件有问题或不正确,或者报告该软件是盗版,因为其他人使用了此人合法购买的许可证密钥,该怎么办?
Aside from it being none of your business, Windows in particular has been known to falsely report that a legitimate copy of Windows was pirated. You should not trust anybody's validation tools but your own (and even then you might have coded a crappy validation tool!). There are so many things that could cause an incorrect piracy report - I would steer way clear of this approach.
除了这不关你的事之外,众所周知,Windows 会错误地报告 Windows 的合法副本被盗版。你不应该相信任何人的验证工具,而应该相信你自己的(即使那样你也可能编写了一个蹩脚的验证工具!)。有很多事情可能会导致不正确的盗版报告 - 我会避开这种方法。
回答by phoebus
The way I see it, I won't ever trust someone else's verification system to be accurate enough that I would be willing to lock people out of using my software.
在我看来,我永远不会相信其他人的验证系统足够准确,以至于我愿意阻止人们使用我的软件。
I see where you're coming from, but I suggest having MS worry about Windows validation.
我知道你来自哪里,但我建议让 MS 担心 Windows 验证。
In addition, there's really no way to know the true legal status of an install through the machine itself. Sure, there's "validation" and all that jazz, but that's nigh meaningless in context of the truth.
此外,真的没有办法通过机器本身了解安装的真实法律状态。当然,有“验证”和所有爵士乐,但这在事实的背景下几乎毫无意义。
回答by ThisIsMeMoony
Just asking the technical part, leaving out your reasons/philosophy would have given you direct answers.
只问技术部分,省略你的理由/哲学会给你直接的答案。
回答by Janis Veinbergs
If you prevent pirating your own software (i mean prevent it running on pirated windows) then probably your software will not be as sucsessfull as it could.
如果您防止盗版您自己的软件(我的意思是防止它在盗版 Windows 上运行),那么您的软件可能不会像它应有的那样成功。
Just make your client pay fair price for your software.
只需让您的客户为您的软件支付合理的价格即可。