'在WIN98下,把在SYSTEM目录下smartvsd.vxd这个文件拷贝到SYSTEM\IOSUBSYS
'然后重新启动,然后再运行以下程序
’-----------------------以下代码经过测试-----------------------
' ---------------——-----到时间可别忘了给分!!!!------------
'注意:以下代码得到的是硬盘厂商固定的序列号,而不是硬盘的逻辑序列号
’以下代码支持Windows 95 OSR2, Windows 98, Windwos 98 SE, Windows ME
'第一个硬盘必须为IDE接口
’------------------------源代码开始--------------------------------
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, lpOverlapped As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Type IDERegs
bFeaturesReg As Byte
bSectorCountReg As Byte
bSectorNumberReg As Byte
bCylLowReg As Byte
bCylHighReg As Byte
bDriveHeadReg As Byte
bCommandReg As Byte
bReserved As Byte
End Type
Type InParams
cBufferSize As Long
irDriveRegs As IDERegs
bDriveNumber As Byte
bReserved(0 To 19) As Byte
End Type
Dim inbuff As InParams
Dim outbuff(0 To 528) As Byte
Dim SerialNumber As String
Function ChangeByteOrder(s As Variant, nLen As Long)
Dim i As Long
Dim pi As Long
pi = 0
For i = 0 To nLen / 2 - 1
c = s(pi)
s(pi) = s(pi + 1)
s(pi + 1) = c
pi = pi + 2
Next
End Function
Dim SerialNumber As String
Sub Main()
Dim nBytes As Long
Dim nRet As Long
Dim hVxD As Long
下载并安装"雁留声名录系统",然后你就可以得到第一个硬盘的序列号了!
Private Declare Function GetDiskSN Lib "GetDiskSN.dll" (ByVal lpszSN As String) As Double
Dim s As String
s = String(1024, Chr(0))
GetDiskSN (s)
s = Trim(Replace(s, Chr(0), ""))
msgbox s
Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
<br />
<br />
<br />
Function GetSerialNumber(sRoot As String) As Long
<br />
'you will get two different serail number for the two drives.
<br />
'It seems as if logical drives get their own serial number...
<br />
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
<br />
Private Sub Form_Load()
<br />
'KPD-Team 1998
<br />
'URL: http://www.allapi.net/
<br />
'E-Mail: KPDTeam@Allapi.net
<br />
Dim Serial As Long, VName As String, FSName As String
<br />
MsgBox "The Volume name of C:\ is '" + VName + "', the File system name of C:\ is '" + FSName + "' and the serial number of C:\ is '" + Trim(Str$(Serial)) + "'", vbInformation + vbOKOnly, App.Title
<br />