Private Function CheckKey(UN As String, SN As String) As String
Dim i As Long, j As Long, k As Long, l As Long
Dim nRowCount As Long, n108 As Long, n10C As Long, n110 As Long, n114 As Long, n118 As Long, n11C As Long, n120 As Long, n124 As Long
Dim tbTemp40(MAXLEN - 1) As Long
Dim tbTemp100(100) As Long
Dim tbRet(MAXLEN * 2) As Byte '返回字符串
Dim tbSN(53) As Long '注册码
Dim tbNO(MAXLEN - 1) As Long '用户名各字符的大小顺序
'----init table------
'这一段是我添加的,作用是对用户名和注册码进行转换。
For i = 1 To Len(UN)
For j = 1 To Len(UN)
If Mid$(UN, i, 1) > Mid$(UN, j, 1) Then
tbNO(i - 1) = tbNO(i - 1) + 1
End If
Next
Next
For i = 1 To Len(SN)
tbSN(i - 1) = Val(Mid$(SN, i, 1))
If i > 53 Then Exit For
Next
'--------------------
'4022AC:
i = 0
j = 0
k = 0
l = 0
'4022C8:
Do Until i >= MAXLEN
tbTemp40(i) = &H1E
i = i + 1
Loop
nRowCount = 0
n108 = 0
If tbSN(0) > 0 Then
nRowCount = MAXLEN \ tbSN(0)
End If
n10C = 0
'40231B:
Do Until n108 >= 2
If n10C > 0 Then
tbTemp40(tbNO(n10C - 1)) = &H1E
End If
n10C = 0
'402350:
Do Until n10C >= MAXLEN
If n10C > 0 Then
tbTemp40(tbNO(n10C - 1)) = &H1E
End If
If n108 = 0 Then
tbTemp40(tbNO(n10C)) = &H28
n10C = n10C + 1
End If
If n108 = 1 Then
tbTemp40(tbNO(n10C)) = &H14
n10C = n10C + 1
End If
'4023D3:
k = 0
For i = 0 To tbSN(0) - 1
For j = 0 To nRowCount - 1
tbTemp100(i * 4 + j) = tbTemp40(k)
k = k + 1
Next
Next
'402448:
n110 = 0
n114 = 0
For i = 0 To nRowCount - 1
n110 = tbTemp100(tbSN(1) * 4 + i) + n110
n114 = tbTemp100(tbSN(2) * 4 + i) + n114
Next
'4024BD:
If n110 = n114 Then '==============================================================================================
If (tbTemp100(tbSN(3) * 4 + tbSN(4))) = (tbTemp100(tbSN(5) * 4 + tbSN(6))) Then
If (tbTemp100(tbSN(7) * 4 + tbSN(8))) = (tbTemp100(tbSN(9) * 4 + tbSN(10))) Then
tbRet(l) = &H6C '"l"
l = l + 1
Else
tbRet(l) = &H6B '"k"
l = l + 1
End If
Else
If (tbTemp100(tbSN(7) * 4 + tbSN(8))) = (tbTemp100(tbSN(9) * 4 + tbSN(10))) Then
tbRet(l) = &H6A '"j"
l = l + 1
Else
tbRet(l) = &H69 '"i"
l = l + 1
End If
End If
End If
'4025B9:
If n110 > n114 Then '==============================================================================================
i = 0
n118 = 0
n11C = 0
tbTemp100(tbSN(1) * 4 + tbSN(11)) = tbTemp100(tbSN(12) * 4 + tbSN(13))
tbTemp100(tbSN(1) * 4 + tbSN(14)) = tbTemp100(tbSN(15) * 4 + tbSN(16))
tbTemp100(tbSN(1) * 4 + tbSN(17)) = tbTemp100(tbSN(18) * 4 + tbSN(19))
tbTemp100(tbSN(2) * 4 + tbSN(20)) = tbTemp100(tbSN(21) * 4 + tbSN(22))
tbTemp100(tbSN(2) * 4 + tbSN(23)) = tbTemp100(tbSN(24) * 4 + tbSN(25))
tbTemp100(tbSN(2) * 4 + tbSN(26)) = tbTemp100(tbSN(27) * 4 + tbSN(28))
'402712:
For i = 0 To nRowCount - 1
n118 = tbTemp100(tbSN(1) * 4 + i) + n118
n11C = tbTemp100(tbSN(2) * 4 + i) + n11C
Next
If n118 > n11C Then '--------------------------------------------------------------------------
If (tbTemp100(tbSN(29) * 4 + tbSN(30))) = (tbTemp100(tbSN(31) * 4 + tbSN(32))) Then
tbRet(l) = &H65 '"e"
l = l + 1
Else
tbRet(l) = &H61 '"a"
l = l + 1
End If
End If
'4027D7:
If n118 < n11C Then '--------------------------------------------------------------------------
If (tbTemp100(tbSN(33) * 4 + tbSN(34))) > (tbTemp100(tbSN(35) * 4 + tbSN(36))) Then
tbRet(l) = &H67 '"g"
l = l + 1
End If
If (tbTemp100(tbSN(33) * 4 + tbSN(34))) < (tbTemp100(tbSN(35) * 4 + tbSN(36))) Then
tbRet(l) = &H66 '"f"
l = l + 1
End If
If (tbTemp100(tbSN(33) * 4 + tbSN(34))) = (tbTemp100(tbSN(35) * 4 + tbSN(36))) Then
tbRet(l) = &H68 '"h"
l = l + 1
End If
End If
'4028DF:
If n118 = n11C Then '--------------------------------------------------------------------------
k = 0
For i = 0 To tbSN(0) - 1
For j = 0 To nRowCount - 1
tbTemp100(i * 4 + j) = tbTemp40(k)
k = k + 1
Next
Next
'402966:
If (tbTemp100(tbSN(37) * 4 + tbSN(38))) > (tbTemp100(tbSN(39) * 4 + tbSN(40))) Then
tbRet(l) = &H62 '"b"
l = l + 1
End If
If (tbTemp100(tbSN(37) * 4 + tbSN(38))) < (tbTemp100(tbSN(39) * 4 + tbSN(40))) Then
tbRet(l) = &H63 '"c"
l = l + 1
End If
If (tbTemp100(tbSN(37) * 4 + tbSN(38))) = (tbTemp100(tbSN(39) * 4 + tbSN(40))) Then
tbRet(l) = &H64 '"d"
l = l + 1
End If
End If
End If
'402A5C:
If n110 < n114 Then '==============================================================================================
i = 0
n120 = 0
n124 = 0
tbTemp100(tbSN(1) * 4 + tbSN(11)) = tbTemp100(tbSN(12) * 4 + tbSN(13))
tbTemp100(tbSN(1) * 4 + tbSN(14)) = tbTemp100(tbSN(15) * 4 + tbSN(16))
tbTemp100(tbSN(1) * 4 + tbSN(17)) = tbTemp100(tbSN(18) * 4 + tbSN(19))
tbTemp100(tbSN(2) * 4 + tbSN(20)) = tbTemp100(tbSN(21) * 4 + tbSN(22))
tbTemp100(tbSN(2) * 4 + tbSN(23)) = tbTemp100(tbSN(24) * 4 + tbSN(25))
tbTemp100(tbSN(2) * 4 + tbSN(26)) = tbTemp100(tbSN(27) * 4 + tbSN(28))
'402BB5:
For i = 0 To nRowCount - 1
n120 = tbTemp100(tbSN(1) * 4 + i) + n120
n124 = tbTemp100(tbSN(2) * 4 + i) + n124
Next
'402C0F:
If n120 > n124 Then '--------------------------------------------------------------------------
If (tbTemp100(tbSN(41) * 4 + tbSN(42))) > (tbTemp100(tbSN(43) * 4 + tbSN(44))) Then
tbRet(l) = &H66 '"f"
l = l + 1
End If
If (tbTemp100(tbSN(41) * 4 + tbSN(42))) < (tbTemp100(tbSN(43) * 4 + tbSN(44))) Then
tbRet(l) = &H67 '"g"
l = l + 1
End If
If (tbTemp100(tbSN(41) * 4 + tbSN(42))) < (tbTemp100(tbSN(43) * 4 + tbSN(44))) Then
tbRet(l) = &H68 '"h"
l = l + 1
End If
End If
'402D17:
If n120 < n124 Then '--------------------------------------------------------------------------
If (tbTemp100(tbSN(45) * 4 + tbSN(46))) = (tbTemp100(tbSN(47) * 4 + tbSN(48))) Then
tbRet(l) = &H65 '"e"
l = l + 1
Else
tbRet(l) = &H61 '"a"
l = l + 1
End If
End If
'402D8B:
If n120 = n124 Then '--------------------------------------------------------------------------
k = 0
For i = 0 To tbSN(0) - 1
For j = 0 To nRowCount - 1
tbTemp100(i * 4 + j) = tbTemp40(k)
k = k + 1
Next
Next
'402E12:
If (tbTemp100(tbSN(49) * 4 + tbSN(50))) > (tbTemp100(tbSN(51) * 4 + tbSN(52))) Then
tbRet(l) = &H63 '"c"
l = l + 1
End If
If (tbTemp100(tbSN(49) * 4 + tbSN(50))) < (tbTemp100(tbSN(51) * 4 + tbSN(52))) Then
tbRet(l) = &H62 '"b"
l = l + 1
End If
If (tbTemp100(tbSN(49) * 4 + tbSN(50))) = (tbTemp100(tbSN(51) * 4 + tbSN(52))) Then
tbRet(l) = &H64 '"d"
l = l + 1
End If
End If
End If
Loop
n108 = n108 + 1
Loop
CheckKey = StrConv(tbRet, vbUnicode)
End Function