经常看到一些共享软件使用密码保护开发者的权益,听说很多使用读区硬盘序列号,进行一些适当‘加工’后,形成注册序列号,开发者根据用户的注册序列号给出一个注册号,软件完成注册。
    1、能否详细解释一下这种方法的具体操作,能够提供源代码?
    2、还有其他简便有效的注册方法吗?

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/2187/2187589.xml?temp=.5035822算法比较难,你还是照辰龙的原代码做吧
      

  2.   

    Option Explicit
    Dim Serial_Number, Activation_Code, Get_Serial_From_Registry
    Private Sub cmdCheck_Click()
        
        Dim Res, Msg
        
    'Check Serial    If Activation_Code = Trim(txtSerial) Then
            
            SaveSetting "App_Name", "Registration", "Code", txtSerial
            Msg = "感谢您的支持,请妥善保管此注册码!"
            Res = MsgBox(Msg, vbInformation, "感谢")
            frmMain.Text1 = Serial_Number
            frmMain.Text2 = Activation_Code
            Unload Me
            frmMain.Show
        
        Else
            Res = MsgBox("注册码错误", vbInformation, "错误!")
            txtSerial.SetFocus
        End If
       
    End Sub
    Private Sub cmdExit_Click()
        End
    End SubPrivate Sub Command1_Click()
        InputBox "您的注册码: ", "", Activation_Code
    End SubPrivate Sub Form_Load()
        
        Serial_Number = GetDriveInfo("C:\", GETDI_SERIAL) ' HD Serial Number
        Text1.Text = Str(Serial_Number)
    'simple calculation ( do your own )
        Activation_Code = Left(Serial_Number, 4)    'Left 4 digits
        Activation_Code = Activation_Code * 881999  'Multiply By 881999
        Activation_Code = Left(Activation_Code, 6)  'Get the left 6 Numbers Only'check if user registerd before
        Get_Serial_From_Registry = GetSetting("App_Name", "Registration", "Code")
        
    'If user already registerd then quit
        If Activation_Code = Get_Serial_From_Registry Then
            frmMain.Text1 = Serial_Number
            frmMain.Text2 = Activation_Code
            Unload Me
            frmMain.Show
    'else show the HD serial code
        Else
            lbl_HD_Serial_Number = Serial_Number
        End If
     End Sub
    ____________
    Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerial_Numberber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    Public Const GETDI_SERIAL = 1
    Public Const GETDI_LABEL = 2
    Public Const GETDI_TYPE = 3
    Function GetDriveInfo(strDrive As String, iType As Integer)
        
        Dim Serial_Number As Long
        Dim Drive_Label As String
        Dim Fat_Type As String
        
        Dim Return_Value As Long
        
        Drive_Label = Space(256)
        Fat_Type = Space(256)
        
        Return_Value = GetVolumeInformation(strDrive, Drive_Label, Len(Drive_Label), Serial_Number, 0, 0, Fat_Type, Len(Fat_Type))
        
        GetDriveInfo = CStr(Serial_Number)End Function
      

  3.   

    我觉得,我有个取硬盘的序列号的程序。有加密和解密功能。
    是用PB做的,是取硬盘的序列号,经过算法后加密。
    不过我的程序每次取硬盘的号码都是数子,我的加密程序对字母不行,只可对数子。然后
    经过配置INI文件,启动程序的时候进行读,咽喉做比较,判断。达到此程序只能在一个机器上运行,但是必须经过我的程序注册,取得加密的密码。