版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、c+设备信息获取方法00426 oem - 8992662-8992662known devices:win32_processor, / / cpu processorwin32 physicalmemory, / / physical memory barwin32_keyboard, / / keyboardwin32 pointingdevice, / / point input device, including the mouse.win32_floppydrive / / floppy drivewin32 diskdrive, / / hard drivewin32 cdrom
2、drive, / / cd-rom drivewin32_baseboard / / motherboardwin32 bios, / / bios chipwin32 parallelport, / / parallel portwin32_serialport, / / serial portwin32 serialportconfiguration, / / serial port configurationwin32 sounddevice, / / multimedia setup, usually a sound card.win32_systemslot, / / motherb
3、oard slot (isa & pci & agp)win32_usbcontroller / / usb controllerwin32_networkadapter / / network adapterwin32_networkadapterconfiguration, / / network adaptersettingswin32_printer, / / printerwin32_printerconfiguration, / / printer setupwin32_printjob, / / printer taskwin32_tcpipprinterport
4、, / / printer portwin32_p0tsmodem / / modemwin32_p0tsmodemtoserialport, / / modem portwin32_desktopmonitor, / / displaywin32_displayconfiguration, / / graphics cardwin32_displaycontrollerconfiguration, / / graphics card setupwin32_vidocontroller, / / graphics card detailswin32_videosettings, / / gra
5、phics support display mode./ / operating systemwin32_timezone, / / time zonewin32_systemdriver, / / driverwin32_diskpartition, / / disk partitionwin32_logicaldisk, / / logical diskwin32_logicaldisktopartition, / / logical disk in the partition and the beginning location.win32_logicalmemoryconfigurat
6、ion, / / logical memory configurationwin32_pagefile, / / system page file informationwin32_pagefilesetting, / / page file settingswin32_bootconfiguration, / / system launch configurationwin32_computersystem, / / computer information briefwin32_0peratingsystem, / / operating system informationwin32_s
7、tartupcommand / / system initiatorwin32_service, / / system installation serviceswin32_group, / / system management groupwin32_groupuser, / / system group accountwin32_useraccount, / / user accountwin32_process, / / system processwin32_thread, / / system threadwin32_share, / / sharewin32_networkclie
8、nt, / / installed network clientwin32_networkprotocol / / installed network protocolcstring, readregistetable (cstring root, cstring path, cstring key)hkeys happkey;the lpctstr winds_service_registry_key 二 path;lpctstr data_file_sub_key 二 key;char szdatafile 80;if (root 二二 hkey_local_machine)if (err
9、or_success 二二 regopenkeyexhkey local machine,winds service registry key,0,key_read,&happkey)ulong cbsize 二 iax_path * sizeof (tchar);dword dwflag 二 regqueryvalueex( happkey,data_file_sub_key,空,空,(lpbyte)szdatafile &cbsize);regclosekey(happkey);如果(error_success 二二 dwflag)装运箱 strdate = szdataf
10、ile;/ /对话框(strdate);如果(strdate. getlength () > 0)返回 strdate:其他回报” ”;返回;如果(root 二二 “hkey_current_user”)如果(error_success 二二 regopenkeyex (hkey current user,winds_service_registry_key,key_read, fehappkey)ulong cbsize 二 iax_path * sizeof (tchar);dword dwflag 二 regqueryvalueex( happkey,data_file_sub_k
11、ey,空,空,(lpbyte)szdatafile &cbsize);regclosekey(happkey);如果(error_success 二二 dwflag)装运箱 strdate = szdatafile;/ /对话框(strdate); 如果(strdate. getlength() > 0)返回 strdate;其他回报” ”返回;返回;获取用户名:getwindowsdirectory (szlnfo, max_path + 1);使用system. management获取系统补丁:;var searchos 二 new managementobjectsear
12、cher ( “从win32_0peratingsystem 中选择*”);响应。写(“<h3>本机最新安装补丁信息:</h3>" + ybr/>”); foreach(在 searchos. get ()中)foreach(var itempro in item. properties)response. write(itemproo 姓名 + “: ” + itemproo 值 + “ br /”);response. write ( " br /”);response. write ("人力资源/ >”);var sear
13、chqfe 二 new managementobjectsearcher ( “从win32_quickfixengineering 中选择*”);响应。写(“<h3>本机历史安装补丁信息:</h3>" + “br/”);foreach (searchqfe. get ()中的 var 项)foreach(var itempro in item .properties)response. write (itemproo 姓名 + itemproo 值 +br / >”);response. write ( br /”);response. write (
14、"人力资源/”);通过注册表: / /通过注册表获取的信息regopenkeyex(hkey_local_machine> regkey、 0、 key_query_value 和 hkey);/ /打开注册表的键;regenumvalue (根键,dwlndex environvariable &dwvari ahi elength,null, null, null, null)/ / query the information we need;getenvironmentvariable (environvariab1e, environstring, 1024);
15、get disk partition information:# include < iostream ># include < windows h >using namespace stdint main ()int diskcount 二 0;dword diskinfo 二 getlogicaldrives ()/ / using the getlogicaldrives () function to get the number of logical drives in the system, the function returns a 32-bit unsi
16、gned integerwhile (diskinfo) / / through the loop operation to see if each data is 1, if 1 is true, if 0 is not availableif (diskinfo & 1) / / through bit operation logic and operation, determines if it is 1+ + diskcount;diskinfo 二 diskinfo 二 diskinfo, > > 1; / / the right move of the bit
17、operation ensures that the location of the check is moved to the right in each loop/ / diskinfo 二 diskinfo / 2;the number of logical disks in the cout <<<<<<<<<<<<<<<<<<<<<< = '<<<<<<='<<<<<int
18、 dslength 二 getlogicaldrivestrings (0, null);/ / get the length of all the drive string information from the getlogicaldrivestrings () functionchar * dstr 二 new char dslength ; / / create a c-style string array in the heap area with the length of the fetchgetlogicaldrivestrings (lptstr);/ / the stri
19、ng information is copied to the heap area array by getlogicaldrivestrings, which holds the infomiation for all the drivesint dtype;int si 二 0;bool fresult:unsigned _int64 i64freebytestocaller;unsigned _int64 i64totalbytes:unsigned _int64 i64freebytes;for (int 1=0; i < dslength / 4; + + i)/ / in o
20、rder to show the state of each drive, through the loop output, dstr due to the internal saved data is a: nullb: nullc: null, this information, so dslength / 4 specific scope of large cycle can be obtainedchar dir 3二dstr si,:, 'cout < < dir.dtype 二 getdrivetype (dstr +1*4);/ / getdrivetype
21、function, which retrieves the driver type, the parameter as the root directory of the driveif (dtype 二二 drive_fixed)cout < < the hard drive"else if (dtype 二二 drive_cdrom)the cout of the light drive"else if (dtype 二二 drive_removable)cout < < ''portable disk"else if
22、(dtype 二二 drive_remote)cout < < "network disk"else if (dtype 二二 drive_ramdisk)cout < < ''virtual ram disk"else if (dtype 二二 drive_unknown)cout < < the unknown device"fresult 二 getdiskfreespaceex (dir,(pularge_integer) & i64freebytestocaller,(pularge_
23、integer) & i64totalbytes,(pularge_integer);/ / getdiskfreespaceex function, which retrieves the space state of the drive disk, returns a bool type dataif (fresult) / / the bool data returned to determine whether the drive is workingcout ( float ) :(float) i64totalbytes / 1024/1024 mb “;/ / total
24、 disk capacity"(float) i64freebytestocaller / 1024/1024 “ mb ; / / disk spacethe elsethe equipment is not ready.cout < < endl;si + 二 4;system (“ pause “);bool getdevicelnfo (cstringarray & arrdrives) 08. 09.dword dw 二:getlogicaldrivestrings (0, null); 10.tchar palldrivers 二 new tchar
25、dw. 11.:getlogicaldrivestrings (dw, palldrivers); 12.lpctstr pdriver = palldrivers; 13.dword drivernum =0; 14.wh订e (pdriver 0! = 0) 15.16.arrdrives add (pdriver); 17.drivernum+; 18.pdriver 二 tcschr (pdriver, 0) + 1; 19. 20.the delete palldrivers; 21.return true; 22. / / function description: functio
26、n name getdevicelnfo/ / function: fetch the driver information/ / getlogicaldrivestrings is formatted as a: ob: 0c: 0/ / parameter description: arrdrives stores all the disks/ / return value description: true successfully false failure 06. / /bool getdevicelnfo (cstringarray & arrdrives)09.dword
27、 dw 二:getlogicaldrivestrings (0, null);10.tchar palldrivers 二 new tchar dw.:getlogicaldrivestrings (dw, palldrivers);pdriver 二 palldrivers;dword drivernum = 014.wh订e (pdriver 0!二 0)15. 0 16.17.drivernum+;18.pdriver 二 tcschr (pdriver, 0)+1;19.20.the delete palldrivers;21.return true;22. int dslength 二 getlogicaldrivestrings (0, null);/ / get the length of all the drive string inf
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 前台的辞职报告模板合集七篇
- 迎新年晚会意义策划
- 2023一年级数学上册 八 认识钟表(小明的一天)教学实录 北师大版
- 2024-2025学年新教材高中化学 第五章 化工生产中的重要非金属元素 1.3 硫酸根离子检验、硫和含硫化合物的相互转化教学实录 新人教版必修2
- 2024秋八年级道德与法治上册 第一单元 成长的空间 第一课 相亲相爱一家人(他们这样做的原因)教学思路 人民版
- 2024年某城市地铁线路建设及运营管理长期租赁合同
- 实际正常和标准成本法ActualNormalandStandardCosting
- 广州市来穗人员服务管理局来穗人员积分制服务管理信息系统
- 2022天宫课堂第三课观后感10篇范文
- 2023二年级数学下册 7 万以内数的认识第8课时 近似数教学实录 新人教版
- 期末试卷(试题)-2024-2025学年五年级上册数学人教版
- 护理安全警示教育-新-
- 社会工作行政复习要点
- 2025年九年级中考数学一轮复习考点突破课件:第28讲 概率
- 教科版二年级上册科学期末试卷及答案
- 2025届天津市重点中学数学高一上期末复习检测试题含解析
- 在线考试系统开发合作协议
- 智慧物流第10套理论题附有答案
- 2024-2030年中国脱毛膏市场消费模式预测与未来销售规模调研报告
- 低压配电系统运行维护操作手册
- 教材解读-2023-2024学年统编版语文四年级下册
评论
0/150
提交评论