阅读背景:

VC获取操作系统相关信息

来源:互联网 

1、获取系统版本

 

	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);
	}	int a=0,b=0,i=0,j=0;
	_asm
	{
	



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: