• 获取系统信息学习


    	DWORD dwEAX = 0;
    	DWORD dwEBX = 0;
    	DWORD dwECX = 0;
    	DWORD dwEDX = 0;
    
    	// 获取CPUID0
    	_asm
    	{
    		mov eax, 0
    		cpuid
    		mov dwEAX, eax
    		mov dwEBX, ebx
    		mov dwECX, ecx
    		mov dwEDX, edx
    	}
    
    	printf("CPUID0:
    EAX = %p
    "
    		   "EBX = %p
    "
    		   "ECX = %p
    "
    		   "EDX = %p
    ",
    		   dwEAX, dwEBX, dwECX, dwEDX);
    
    	puts("");
    
    	// 获取CPUID1
    	_asm
    	{
    		mov eax, 1
    			cpuid
    			mov dwEAX, eax
    			mov dwEBX, ebx
    			mov dwECX, ecx
    			mov dwEDX, edx
    	}
    
    	printf("CPUID1:
    EAX = %p
    "
    		"EBX = %p
    "
    		"ECX = %p
    "
    		"EDX = %p
    ",
    		dwEAX, dwEBX, dwECX, dwEDX);
    
    	puts("");
    
    
    	// 参数1的结构体
    	PIP_ADAPTER_INFO tag_AdapterInfo = new IP_ADAPTER_INFO[sizeof(IP_ADAPTER_INFO)];
    	PIP_ADAPTER_INFO lpTemp = tag_AdapterInfo;
    
    	// 参数2的大小
    	ULONG lLen = sizeof(IP_ADAPTER_INFO);
    
    	GetAdaptersInfo(tag_AdapterInfo, &lLen);
    	GetAdaptersInfo(tag_AdapterInfo, &lLen);
    
    	// 循环获取机器上的所有网卡信息.
    	while(lpTemp)
    	{
    		printf("MAC: %02x-%02x-%02x-%02x-%02x-%02x
    ",
    			   lpTemp->Address[0],
    			   lpTemp->Address[1],
    			   lpTemp->Address[2],
    			   lpTemp->Address[3],
    			   lpTemp->Address[4],
    			   lpTemp->Address[5]);
    
    		lpTemp = lpTemp->Next;
    	}
    
    
    	delete[] tag_AdapterInfo;
    
    	puts("");
    
    
    	/*
    	LONG RegOpenKeyEx(
    	HKEY hKey,         // handle to open key
    	LPCTSTR lpSubKey,  // subkey name
    	DWORD ulOptions,   // reserved
    	REGSAM samDesired, // security access mask
    	PHKEY phkResult    // handle to open key
    	);
    
    	*/
    
    
    	HKEY hKey = NULL;
    	RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\DESCRIPTION\System\", 0, KEY_ALL_ACCESS, &hKey);
    
    	/*
    	LONG RegQueryValueEx(
    	HKEY hKey,            // handle to key
    	LPCTSTR lpValueName,  // value name
    	LPDWORD lpReserved,   // reserved
    	LPDWORD lpType,       // type buffer
    	LPBYTE lpData,        // data buffer
    	LPDWORD lpcbData      // size of data buffer
    	);
    	*/
    
    	DWORD dwType = 0;
    	BYTE szKeyValue[MAXBYTE] = {0};
    	DWORD dwKeyValueLen = sizeof(szKeyValue);
    
    	RegQueryValueEx(hKey, "SystemBiosVersion", NULL, &dwType, szKeyValue, &dwKeyValueLen);
    
    	printf("Bios: %s", szKeyValue);
    
    	puts("");
    
    	system("pause");
    
    	return 0;

  • 相关阅读:
    「AHOI / HNOI2017」单旋
    【CQOI2012】局部极小值
    【CQOI2011】放棋子
    【gdoi2018 day2】第二题 滑稽子图
    【JSOI2018】潜入行动
    在vue中获取不到canvas对象? 两种解决办法。
    数据可视化echart
    在vue中使用高德地图开发,以及AMap的引入?
    mac 常使用的一些小技巧
    form编码方式application/x-www-form-urlencoded和multipart/form-data的区别?
  • 原文地址:https://www.cnblogs.com/zcc1414/p/3982474.html
Copyright © 2020-2023  润新知