急!!!我要写一个扫描器,毕业答辩好混过去,已经能够扫描某一网段哪些主机开了哪些端口,老师还让加功能,要求能够获得某一主机的操作系统类型,求各位高手救急,点拨点拨,该如何实现?小弟是生手,请讲仔细些,有源代码就更好了。
解决方案 »
- 如何用VC下的性能计数器获得CPU使用率
- 怎样使保存的图元文件跟原大小一致?
- 关于throw抛出异常的造成内存泄露的问题?高手进~,在线等,高分~~~~~
- 100分求类似QQ的源代码,就是哪个联系人的Tencent_UserBar_Class_Ver1.0,难点在于那个滚动条也自定义。
- 打开文件对话框(CFileDialog)的简单问题
- ActiveX中获取主类指针的问题,已经2天了,都没有人回答,麻烦高手出招(高分)!
- 编辑框的问题,在线等候
- 怎样将 child 风格的 对话框 popup?
- MATLAB转vc
- 用类向导添加的消息映射函数也有错?
- 如何改一个应用程序的标题
- 关于ADO的结果集(_RecordsetPtr m_pRecordset)的问题求教
The OSVERSIONINFO data structure contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and descriptive text about the operating system. This structure is used with the GetVersionEx function.typedef struct _OSVERSIONINFO{
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
TCHAR szCSDVersion[ 128 ];
} OSVERSIONINFO;
Members
dwOSVersionInfoSize
Specifies the size, in bytes, of this data structure. Set this member to sizeof(OSVERSIONINFO) before calling the GetVersionEx function.
dwMajorVersion
Identifies the major version number of the operating system. For example, for Windows NT version 3.51, the major version number is 3; and for Windows NT version 4.0, the major version number is 4.
dwMinorVersion
Identifies the minor version number of the operating system. For example, for Windows NT version 3.51, the minor version number is 51; and for Windows NT version 4.0, the minor version number is 0.
dwBuildNumber
Windows NT: Identifies the build number of the operating system.
Windows 95: Identifies the build number of the operating system in the low-order word. The high-order word contains the major and minor version numbers. dwPlatformId
Identifies the operating system platform. This member can be one of the following values: Value Platform
VER_PLATFORM_WIN32s Win32s on Windows 3.1.
VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95 or Windows 98.
For Windows 95, dwMinorVersion is zero. For Windows 98, dwMinorVersion is greater than zero.
VER_PLATFORM_WIN32_NT Win32 on Windows NT.
szCSDVersion
Windows NT: Contains a null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty.
Windows 95: Contains a null-terminated string that provides arbitrary additional information about the operating system.
判断操作系统类型,用下面的代码可以了:
OSVERSIONINFO osvi;
CString winver,os;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx (&osvi);
switch(osvi.dwPlatformId)
{
case 0:
os = "Windows 3.x";
break;
case 1:
os = "Windows 95/98/Me";
break;
case 2:
os = "Windows NT/2000";
break;
}
看其Software里的值就是了.
sevencat(七猫) :能给小弟讲仔细些吗?感激!
请大家再多支持,谢谢!