请问有谁知道C++语言,如何获取磁盘、CPU、网卡的序列号

来源:百度知道 编辑:UC知道 时间:2024/05/26 21:32:23
请问有谁知道C++语言,如何获取磁盘、CPU、网卡的序列号,知道请把源代码发到我的邮箱,zhaojun917@163.com,直接回答也可以哈!!!注意:是C++源码,控制台程序使用的,不要用WINPI。

#include "stdafx.h"
#include<iostream>
using namespace std;
#include <Windows.h>

LPTSTR namebuf=new char[12];
DWORD namesize=12;
DWORD serialnumber;
DWORD maxlen;
DWORD fileflag;
LPTSTR sysnamebuf=new char[10];
DWORD sysnamesize=10;
//int num=m_disklist.GetItemCount();
int main()
{
::GetVolumeInformation("C:\\",namebuf,namesize,&serialnumber,&maxlen,&fileflag,
sysnamebuf,sysnamesize);
cout << hex<< serialnumber<<endl;

return 0;
}

这个问题查找相应的API

CPU的序列号可以使用内联汇编,用专门的指令得到,其他的要查看相应的系统调用,在Linux下,涉及到驱动开发。当然,直接读取系统配置文件也可以,呵呵。