2011-09-25 125 views

回答

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; 
} 
+8

'if(expression)return true; [else] return false;'可以用'return expression替換;' – fredoverflow

+0

是的,剛剛從代碼項目中複製,沒有自己寫:D –

+2

return state == SL_GENUINE_STATE :: SL_GEN_STATE_IS_GENUINE; – Tim

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 
0

Java的解決方案是使用Process運行C++或VBScript解決方案作爲一個子進程。

相關問題