#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);
if(state==SL_GENUINE_STATE::SL_GEN_STATE_IS_GENUINE)
return true;
return false;
}
———————–判断网络是否连接————————
#include <wininet.h>
#pragma comment(lib,”Wininet.lib”)
bool bConnect=InternetCheckConnection(L”http://www.google.com”,
FLAG_ICC_FORCE_CONNECTION ,0);
———————–判断是否为win7————————
bool IsWindows7()
{
OSVERSIONINFOEX osvi;
bool bOsVersionInfoEx=false;
DWORD dwType=0UL;
bool bWin7=false;
ZeroMemory(&osvi, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
return -1;
if(osvi.dwMajorVersion==6)
{
if(osvi.dwMinorVersion==1)
{
if(osvi.wProductType==VER_NT_WORKSTATION)
{
bWin7=true;
}
}
}
return bWin7;
}