How to get harddrive serial number in C or asm without wmi

荒凉一梦 提交于 2019-12-08 13:05:56

问题


how to get harddrive serial number(not the volume # wich change at each reinstall of windows) in C or asm, without wmi (cause wmi required admin right). Any clue would be helpfull cause right now i found nothing on web in C without wmi, in dayss of searching... Thank you. EDIT : For windows system


回答1:


Please try my open source tool, DiskId32, which also has the source code at http://www.winsim.com/diskid32/diskid32.html . I only have an Win32 version at this time. Maybe some day I will add a Win64 version.




回答2:


Hard drive serial number and other information about the harddrive like firmware version, etc. can only be obtained using SMART as far as I know and that requires special ioctls to the the block device node (/dev/sda or /dev/sdb) which is usually not available to a regular user.

I know there is a tool called smartctl which does exactly this:

sudo smartctl -i /dev/sda

Similar tools exist (hdparm, lshw, etc.) as well.

As far as trying to figure it out this info without being a privileged user, it might be possible only if it is exposed via /proc or /sys which I highly doubt is being done in the current SATA block device drivers.



来源:https://stackoverflow.com/questions/15079976/how-to-get-harddrive-serial-number-in-c-or-asm-without-wmi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!