惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
小众软件
小众软件
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
C
Check Point Blog
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
罗磊的独立博客
有赞技术团队
有赞技术团队
V
V2EX
Y
Y Combinator Blog
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
F
Fortinet All Blogs
W
WeLiveSecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
MyScale Blog
MyScale Blog
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
PCI Perspectives
PCI Perspectives
H
Heimdal Security Blog
Schneier on Security
Schneier on Security
Security Latest
Security Latest
AWS News Blog
AWS News Blog
月光博客
月光博客
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
博客园 - Franky
Cisco Talos Blog
Cisco Talos Blog
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
N
News and Events Feed by Topic
Cloudbric
Cloudbric
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
Attack and Defense Labs
Attack and Defense Labs

博客园 - Sleet(冰雨)

中国免费资源站全集 论程序员与妓女 I Believe I Can Fly 开机BIOS语言一点通 开始→运行→输入的命令集锦(较全) 局域网类故障 License的C语言代码! c++程序员的爱情诗 湖北城市班级篇 众球星对Baggio的评价! 被称为世上最经典的25句话! 大学生的毕业前与毕业后 比尔盖茨死了 用VB制作一个简单的MP3播放器 春天来了(散文诗) 经典的大学学习生活心得 2004年最欠揍的短信息(转) 《我的理想女友》(转帖) BBS,你给了我那么多!(转帖)
用diskid.dll和disk32.dll获得硬盘序列号
Sleet(冰雨) · 2005-03-10 · via 博客园 - Sleet(冰雨)

1.调用diskid.dll实现:

  Option Explicit
  Private Declare Function IsWinNT Lib "DiskID.DLL" () As Long
  Private Declare Function ReadPhysicalDrive9X Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long
  Private Declare Function ReadPhysicalDriveInNT Lib "DiskID.DLL" (driveID As Long, buffer As Long, bufLen As Long) As Long

  Private Type DRIVER_INFO_OK
  ModalNumber(39) As Byte
  SerialNumber(19) As Byte
  ControlNum(7) As Byte
  DriveType As Long
  Cylinders As Long
  Heads As Long
  Sectors As Long
  End Type

  Private Sub Command1_Click()
  Dim x As DRIVER_INFO_OK
  Dim i As Long
  If IsWinNT = 1 Then
  i = ReadPhysicalDriveInNT(ByVal 0, ByVal VarPtr(x), ByVal 256)
  Else
  i = ReadPhysicalDrive9X(ByVal 0, ByVal VarPtr(x), ByVal 256)
  End If

 Dim s As String
  s = StrConv(x.ModalNumber, vbUnicode)
  s = Left(s, InStr(1, s, Chr(0)) - 1)
  MsgBox "硬件厂商代码为:" + s
  s = StrConv(x.SerialNumber, vbUnicode)
  s = Left(s, InStr(1, s, Chr(0)) - 1)
  MsgBox "硬盘序列号为:" + s
  End Sub

  2.调用diskid32.dll实现:

  Option Explicit
  Private Declare Function DiskID32 Lib "DiskID32.DLL" (ByRef DiskModel As Byte, ByRef DiskID As Byte) As Long

  Private Sub Command1_Click()
  Dim DiskModel(31) As Byte, DiskID(31) As Byte, i As Integer, Model As String, ID As String
  If DiskID32(DiskModel(0), DiskID(0)) <> 1 Then
  MsgBox "get diskid32 err"
  Exit Sub
  End If
  For i = 0 To 31
  If Chr(DiskModel(i)) <> Chr(0) Then
  Model = Model & Chr(DiskModel(i))
  End If
  If Chr(DiskID(i)) <> Chr(0) Then
  ID = ID & Chr(DiskID(i))
  End If
  Next
  MsgBox "硬件产生代码为:" + Model
  MsgBox "硬盘序列号为:" + ID

  End Sub

  说明:diskid.dll可从http://www.applevb.com/lib/diskio.rar下载,diskid32.dll可从

http://www.downez.com/down.asp?id=1149&no=1下载