GetVolumeInformation来得到磁盘序列号等信息
2014-11-05 14:08
507 查看
硬盘序列号: 英文名 Hard Disk Serial Number, 该号是出厂时生产厂家为区别产品而设置的, 是唯一的, 是只读的, 利用硬盘序列号的加密往往是利用其唯一和只读的特性, 大多是针对有序列号的 IDE HDD而言, 对于没有序列号或SCSI HDD硬盘则无能为力, 这也是利用它进行加密的局限性.
卷的序列号: 英文名 Volume Serial Number, 该号既可指软磁盘要得, 如: A:盘和B:盘的, 又可以指硬盘的逻辑盘, 如: C:, D:...的, 是高级格式化时随机产生的, 是可以修改的, 所以利用其进行 加密, 其唯一性还可, 而其可修改性对于安全而言就大打折扣了.
如何得到磁盘序列号和卷标及其它信息主要就是要调用GetVolumeInformation这个API函数,函数声明如下
BOOL GetVolumeInformation(
LPCTSTR lpRootPathName, // address of root directory of the
// file system
LPTSTR lpVolumeNameBuffer, // address of name of the volume
DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
LPDWORD lpVolumeSerialNumber, // address of volume serial number
LPDWORD lpMaximumComponentLength,
// address of system's maximum
// filename length
LPDWORD lpFileSystemFlags, // address of file system flags
LPTSTR lpFileSystemNameBuffer, // address of name of file system
DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
);
[VB]
Public Declare Function GetVolumeInformation& Lib "kernel32" Alias "Ge
tVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNam
eBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber
As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long,
ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As
Long)
用API 函数GetVolumeInformation得到的不是硬盘的序列号!!! 看看英文啊:VolumeSerialNumber!得到的只是卷区序列号!
硬盘的序列号应该是
Drive Model Number________________: WDC WD400EB-00CPF0
Drive Serial Number_______________: WD-WCAATF083586
Drive Controller Revision Number__: 06.04G06
Controller Buffer Size on Drive___: 2097152 bytes
Drive Type________________________: Fixed
Drive Size________________________: 40020664320 bytes
中:
Drive Serial Number_______________: WD-WCAATF083586 这才是硬盘Serial Number!!!!
这个号是不会因为你格式化硬盘而改动,也不是网上流传的修改工具能改的,(其实网上流传的修改工具的也不过是卷区号而已,真是哭笑不得!)
硬盘序列号与磁盘序列号不同,磁盘序列号是硬盘分区中某个卷(volumn)也就是我们说的磁盘的序列号。而硬盘序列号是整块硬盘的序列号,不能被修改。
卷的序列号: 英文名 Volume Serial Number, 该号既可指软磁盘要得, 如: A:盘和B:盘的, 又可以指硬盘的逻辑盘, 如: C:, D:...的, 是高级格式化时随机产生的, 是可以修改的, 所以利用其进行 加密, 其唯一性还可, 而其可修改性对于安全而言就大打折扣了.
如何得到磁盘序列号和卷标及其它信息主要就是要调用GetVolumeInformation这个API函数,函数声明如下
BOOL GetVolumeInformation(
LPCTSTR lpRootPathName, // address of root directory of the
// file system
LPTSTR lpVolumeNameBuffer, // address of name of the volume
DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
LPDWORD lpVolumeSerialNumber, // address of volume serial number
LPDWORD lpMaximumComponentLength,
// address of system's maximum
// filename length
LPDWORD lpFileSystemFlags, // address of file system flags
LPTSTR lpFileSystemNameBuffer, // address of name of file system
DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
);
[VB]
Public Declare Function GetVolumeInformation& Lib "kernel32" Alias "Ge
tVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNam
eBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber
As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long,
ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As
Long)
用API 函数GetVolumeInformation得到的不是硬盘的序列号!!! 看看英文啊:VolumeSerialNumber!得到的只是卷区序列号!
硬盘的序列号应该是
Drive Model Number________________: WDC WD400EB-00CPF0
Drive Serial Number_______________: WD-WCAATF083586
Drive Controller Revision Number__: 06.04G06
Controller Buffer Size on Drive___: 2097152 bytes
Drive Type________________________: Fixed
Drive Size________________________: 40020664320 bytes
中:
Drive Serial Number_______________: WD-WCAATF083586 这才是硬盘Serial Number!!!!
这个号是不会因为你格式化硬盘而改动,也不是网上流传的修改工具能改的,(其实网上流传的修改工具的也不过是卷区号而已,真是哭笑不得!)
硬盘序列号与磁盘序列号不同,磁盘序列号是硬盘分区中某个卷(volumn)也就是我们说的磁盘的序列号。而硬盘序列号是整块硬盘的序列号,不能被修改。
相关文章推荐
- 用GetVolumeInformation得到的不是硬盘的序列号,不要再抄这样的错误好吗?
- GetVolumeInformation获取磁盘信息与DeviceIoControl获取硬盘信息
- GetVolumeInformation获取磁盘信息与DeviceIoControl获取硬盘信息
- 获取磁盘序列号GetVolumeInformation
- WinAPI: GetVolumeInformation - 读取文件系统信息
- 手动删除System Volume Information文件夹信息,增加磁盘应用空间
- 使用GetVolumeInformation获取硬盘信息
- c# API使用GetVolumeInformation函数获取硬盘信息
- 获取磁盘类型及剩余空间 GetDiskFreeSpaceEx GetDriveTypeW GetVolumeInformation
- WinAPI: GetVolumeInformation - 读取文件系统信息
- WinAPI: GetVolumeInformation - 读取文件系统信息
- GetVolumeInformation - 读取文件系统信息
- MFC杂项01 重写键盘相应事件 +创建和装载常规dll文件 +GetVolumeInformation获取本地硬盘序列号
- WinAPI: GetVolumeInformation - 读取文件系统信息
- 利用API函数 GetVolumeInformation 获取盘区信息
- GetVolumeInformation
- GetVolumeInformation函数解释
- 使用FormatMessage得到GetLastError()的詳細信息
- 利用OleDb的GetOLEDBSchemaTable方法得到数据库架构信息
- vfio 通过VFIO_DEVICE_GET_REGION_INFO得到io信息,然后mmap到user space使用