??????PEB???д??????????汾??????????
????ULONG OSMajorVersion; // A4h ?????a4h????????????汾??
????ULONG OSMinorVersion; // A8h ?????a8h???????????汾??
??????????OSMajorVersion??OSMinorVersion????????????????????汾??
????FS?μ??????????TEB??????TEB???0x30????PEB??????????????????????PEB?е??????
?????????????????汾????????λ?????????????
????2000 0X0500
????XP 0X0501
????2003 0X0502
????VISTA 0X0600
????Win7 0X0601
??????????????Щ???????????????????API?????????????????汾?????
void XXX::GetSystem()
{
int a=0??b=0??i=0??j=0;
_asm
{
pushad
mov ebx??fs:[0x18] ; get self pointer from TEB
mov eax??fs:[0x30] ; get pointer to PEB / database
mov ebx??[eax+0A8h] ; get OSMinorVersion
mov eax??[eax+0A4h] ; get OSMajorVersion
mov j??ebx
mov i??eax
popad
}
if((i==5)&&(j==0))
{
AfxMessageBox(_T("???汾? Windows 2000")??MB_OK);
}
else if((i==5)&&(j==1))
{
AfxMessageBox(_T("???汾? Windows XP")??MB_OK);
}
else if((i==5)&&(j==2))
{
AfxMessageBox(_T("???汾? Windows 2003")??MB_OK);
}
else if((i==6)&&(j==0))
{
AfxMessageBox(_T("???汾? Windows Vista")??MB_OK);
}
else if((i==6)&&(j==1))
{
AfxMessageBox(_T("???汾? Win7")??MB_OK);
}
}