是否可以通过编程方式检查Windows安装是否为正版? 让我们说我想从C,C ++,Java或Python检查Windows 7.
答案 0 :(得分:2)
这来自CodeProject,在C ++中(Check for Windows Genuine in VC++)
#include <slpublic.h>
#pragma comment(lib,"Slwga.lib")
bool IsWindowsGenuine()
{
GUID uid;
RPC_WSTR rpc=(RPC_WSTR)_T("55c92734-d682-4d71-983e-d6ec3f16059f");
UuidFromString(rpc,&uid);
SL_GENUINE_STATE state;
SLIsGenuineLocal(&uid,&state,NULL);
return state == SL_GENUINE_STATE::SL_GEN_STATE_IS_GENUINE;
}
答案 1 :(得分:1)
来自here:这是一个执行此操作的vbscript
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colWPA = objWMIService.ExecQuery _
("Select * from Win32_WindowsProductActivation")
For Each objWPA in colWPA
Wscript.Echo "Activation Required: " & objWPA.ActivationRequired
Wscript.Echo "Description: " & objWPA.Description
Wscript.Echo "Product ID: " & objWPA.ProductID
Wscript.Echo "Remaining Evaluation Period: " & _
objWPA.RemainingEvaluationPeriod
Wscript.Echo "Remaining Grace Period: " & objWPA.RemainingGracePeriod
Wscript.Echo "Server Name: " & objWPA.ServerName
Next
答案 2 :(得分:0)
Java解决方案是使用Process
作为子进程运行C ++或VBScript解决方案。