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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 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下载