admin 管理员组

文章数量: 887006

#include <stdio.h>
#include <windows.h>
#include <iostream>  
#include <DXGI.h>  
#include <vector>  

#pragma comment(lib,"DXGI.lib") 
#pragma warning(disable: 4996)   


//获取操作系统信息
void GetOsInfo(char * pWindowsVersion,int * pWindowsOSBit)
{
	//获取操作系统版本
	char WindowsVersion[256] = { 0 };

	//获取8.1以上版本操作系统名称
	//先判断是否为win8.1或win10
	HMODULE hm = NULL;
	if (hm = LoadLibrary(TEXT("ntdll.dll")))
	{
		DWORD dwMajor = 0, dwMinor = 0, dwBuildNumber = 0;
		typedef void (WINAPI *getver)(DWORD*, DWORD*, DWORD*);
		getver gv = NULL;
		gv = (getver)GetProcAddress(hm, "RtlGetNtVersionNumbers");
		if (gv)
		{
			gv(&dwMajor, &dwMinor, &dwBuildNumber);
			//printf("Major is %d\nMinor is %d\nOptional Build is %d\n", dwMajor, dwMinor, dwBuildNumber);
			if (dwMajor == 6 && dwMinor == 3) //win 8.1
			{
				sprintf_s(WindowsVersion, "%s", "Windows 8.1");
			}
			else if (dwMajor == 10 && dwMinor == 0) //win 10
			{
				sprintf_s(WindowsVersion, "%s", "Windows 10");
			}
		}

		FreeLibrary(hm);

		//如果没有输出版本
		if (WindowsVersion[0] == 0)
		{
			//获取8.1以下版本操作系统名称
			// get os name according to version number
			OSVERSIONINFO osver = { sizeof(OSVERSIONINFO) };
			GetVersionEx(&osver);

			if (osver.dwMajorVersion == 5 && os

本文标签: 显卡 系统 信息 Windows