typedef enum tagWin32SysType{
Windows32s,
WindowsNT3,
Windows95,
Windows98,
WindowsME,
WindowsNT4,
Windows2000,
WindowsXP,
WindowsVista,
Windows7,
Nothing
}Win32SysType;
HRESULT STDMETHODCALLTYPE
CVrvProtect::CqGetOsVerion()
{
Win32SysType ShellType = Nothing;
DWORD winVer;
OSVERSIONINFO *osvi;
winVer = GetVersion();
if( winVer < 0x80000000 )
{/*NT */
ShellType=WindowsNT3;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if( osvi != NULL )
{
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
if( FALSE == GetVersionEx(osvi) )
{
ShellType = Nothing;
return ShellType;
}
if(osvi->dwMajorVersion==4L)ShellType = WindowsNT4;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==0L)ShellType = Windows2000;
else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==1L)ShellType = WindowsXP;
else if(osvi->dwMajorVersion==6L&&osvi->dwMinorVersion==0L)ShellType = WindowsVista;
else if(osvi->dwMajorVersion==6L&&osvi->dwMinorVersion==1L)ShellType = Windows7;
free(osvi);
}
}
else if( LOBYTE(LOWORD(winVer) ) < 4 )
{
ShellType = Windows32s;
}
else
{
ShellType = Windows95;
osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO));
if (osvi!=NULL){
memset(osvi,0,sizeof(OSVERSIONINFO));
osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
if( FALSE == GetVersionEx(osvi) )
{
ShellType = Nothing;
return ShellType;
}
if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==10L)ShellType = Windows98;
else if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==90L)ShellType = WindowsME;
free(osvi);
}
}
return ShellType;
}