各位高手,现在我的问题是,怎么样对软件进行加密,加密的语言是用vb,加密的算法是,我想要一个函数来获得硬盘的序列号,但不知道用什么函数来获得硬盘的序列号,请那位高手过来指点指点 ,谢谢

解决方案 »

  1.   

    '申明api函数,读程序所在硬盘序列号
    Public Declare Function GetVolumeInformation& Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)'读程序所在硬盘序列号函数
    Public Function DriveSerial(ByVal sDrv As String) As Long
    Dim RetVal As Long
    Dim str As String * 256
    Dim str2 As String * 256
    Dim a As Long
    Dim b As Long    Call GetVolumeInformation(sDrv & ":\", str, 256, RetVal, a, b, str2, 256)
        DriveSerial = RetVal
    End Function用法:
    '硬盘序列号
    Text1 = DriveSerial("c")