IF PARENT.rb_ever.checked THEN //4
IF (((len(PARENT.em_1.text) <> 4 OR len(PARENT.em_2.text) <> 4) OR len(PARENT.em_3.text) <> 4) OR len(PARENT.em_4.text) <> 4) THEN //6
messagebox("注册码错误","请输入完整的注册码!")
RETURN
END IF //6
ELSE //4
IF len(PARENT.em_5.text) <> 4 THEN //13
messagebox("注册码错误","请输入完整的注册码!")
RETURN
END IF //13
END IF //4
IF PARENT.rb_ever.checked THEN //24
ls_rn = PARENT.em_1.text + PARENT.em_2.text + PARENT.em_3.text + PARENT.em_4.text
ELSE //24
ls_rn = PARENT.em_5.text
END IF //24
setprofilestring(gs_win_dir + acad.is_file_name,"wadxz","rn",ls_rn)
acad.ib_inreg = TRUE
acad.indoor()
IF acad.ib_redrawed = TRUE THEN //82
messagebox("软件注册","软件注册注册成功!~n您已经拥有 Gearbox 5.0 的全部功能!")
IF isvalid(w_gbox_input) = FALSE AND isvalid(w_gbox_cust) = FALSE AND isvalid(w_frame) = FALSE THEN //85
open(w_start)
END IF //85
close(PARENT)
RETURN
ELSE //82
messagebox("软件注册","您输入的注册码无效!请与供应商联系获得正确的注册码!")
END IF //82
RETURN
然后根据代码中的函数名称找到对应的函数代码,逐步阅读,
最后用VB改写成注册机代码如下
Private Sub Command1_Click()
Dim li_lcw As Integer
Dim li_ls2e As Integer
Dim li_lam As Integer
Dim li_mp As Integer
Dim ls_matrix As String
Dim ls_mov1 As String
Dim ls_mov2 As String
Dim ls_codeword As String
Dim ls_cwl As String
Dim ls_encryptedstring As String
Dim ls_encryptedletter As String
Dim lsa_cryptmatrix(1 To 97) As String
Dim li_x As Integer
Dim li_y As Integer
Dim li_z As Integer
Dim li_w As Integer
Dim ls_c2e As String
Dim ls_str2encrypt As String
ls_codeword = "ilikedress"
ls_matrix = "73ColinabcdefghjkmpqrstuvwxyzABDEFGHIJKLMNOPQRSTUVWXYZ 12456890-.#/\!@$<>&*()[]{}';:,?=+`^|%_"
ls_matrix = ls_matrix + Chr(34)
li_w = 1
li_lam = Len(ls_matrix)
lsa_cryptmatrix(1) = ls_matrix
For li_x = 2 To li_lam
ls_mov1 = Left(lsa_cryptmatrix(li_w), 1)
ls_mov2 = Right(lsa_cryptmatrix(li_w), li_lam - 1)
lsa_cryptmatrix(li_x) = ls_mov2 + ls_mov1
li_w = li_w + 1
Next
ls_str2encrypt = "$!o{&<}${]966@-9$8@!XVV6ZX"
li_ls2e = Len(ls_str2encrypt)
li_lcw = Len(ls_codeword)
ls_encryptedletter = ""
ls_encryptedstring = ""
li_y = 1
For li_x = 1 To li_ls2e
ls_c2e = Mid(ls_str2encrypt, li_x, 1)
li_mp = InStr(ls_matrix, ls_c2e)
ls_cwl = Mid(ls_codeword, li_y, 1)
For li_z = 1 To li_lam
If Mid(lsa_cryptmatrix(li_z), li_mp, 1) = ls_cwl Then
ls_encryptedletter = Left(lsa_cryptmatrix(li_z), 1)
ls_encryptedstring = ls_encryptedstring + ls_encryptedletter
End If
Next
li_y = li_y + 1
If li_y > li_lcw Then li_y = 1
Next
MsgBox ls_encryptedstring
End Sub
Private Sub Command2_Click()
Dim as_in As String
Dim ls_out As String
Dim ls_number_code As String
Dim ls_string_code As String
Dim ls_matrix As String
Dim ll_no As Long
Dim ll_len As Long
Dim ll_code_no As Long
Dim ll_code_len As Long
Dim ll_sum As Long
Dim ls_digit As String
Dim ls_digit_revert As String
Dim ls_code_char As String
Dim ls_encrypt_char As String
Dim li_code_pos As Integer
Dim li_matrix_pos As Integer
as_in = Trim(Text1.Text)
ls_string_code = "WZBNCHSDXR"
ls_number_code = "0123456789"
ls_matrix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ll_len = Len(as_in)
For ll_no = 1 To ll_len
ls_digit = Mid(as_in, ll_no, 1)
ls_digit_revert = Mid(as_in, ll_len - ll_no + 1, 1)
li_code_pos = InStr(ls_number_code, ls_digit)
ls_code_char = Mid(ls_string_code, li_code_pos, 1)
ll_sum = 1.67 * ll_sum + Val(ls_digit_revert) + li_code_pos
li_matrix_pos = (InStr(ls_matrix, ls_code_char) + ll_sum) Mod 26
'MsgBox str(ll_sum)
If li_matrix_pos < 1 Then
li_matrix_pos = 1
End If
ls_encrypt_char = Mid(ls_matrix, li_matrix_pos, 1)
If ll_no = 1 Or ll_no = 2 Or ll_no = 3 Or ll_no = 5 Or ll_no = 6 Or ll_no = 7 Or ll_no = 8 Or ll_no = 9 Or ll_no = 11 Then
Select Case ls_encrypt_char
Case "A"
ls_encrypt_char = "1"
Case "B"
ls_encrypt_char = "2"
Case "C"
ls_encrypt_char = "3"
Case "D"
ls_encrypt_char = "4"
Case "E"
ls_encrypt_char = "5"
Case "F"
ls_encrypt_char = "6"
Case "G"
ls_encrypt_char = "7"
Case "H"
ls_encrypt_char = "8"
Case "I"
ls_encrypt_char = "9"
Case "J"
ls_encrypt_char = "1"
Case "K"
ls_encrypt_char = "2"
Case "L"
ls_encrypt_char = "3"
Case "M"
ls_encrypt_char = "4"
Case "N"
ls_encrypt_char = "5"
Case "O"
ls_encrypt_char = "6"
Case "P"
ls_encrypt_char = "7"
Case "Q"
ls_encrypt_char = "8"
Case "R"
ls_encrypt_char = "9"
Case "S"
ls_encrypt_char = "1"
Case "T"
ls_encrypt_char = "2"
Case "U"
ls_encrypt_char = "3"
Case "V"
ls_encrypt_char = "4"
Case "W"
ls_encrypt_char = "5"
Case "X"
ls_encrypt_char = "6"
Case "Y"
ls_encrypt_char = "7"
Case "Z"
ls_encrypt_char = "8"
End Select
End If
ls_out = ls_out + ls_encrypt_char
Next
Text2.Text = ls_out