OSVERSIONINFOEX osif = {0};
osif.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
::GetVersionEx((OSVERSIONINFO*)&osif);
if (osif.dwMajorVersion == 6) //vista or 2008
{
HANDLE hProcess = GetCurrentProcess();
HANDLE hToken = 0;
if (OpenProcessToken(hProcess,TOKEN_ALL_ACCESS , &hToken))
{
DWORD dwEnabled = 0;
SetTokenInformation(hToken,TOKEN_INFORMATION_CLASS(24),&dwEnabled,sizeof(dwEnabled));//24==TokenVirtualizationEnabled
}
}