Private Sub Dir1_Change() ' DirListBox
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change() 'DriveListBox
On Error Resume Next
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click() 'FileListBox
Dim filemdb As String
Dim code97(13) As Integer
Dim code2k(13) As Integer
Dim str As String
Dim ver As Integer
Dim encflag As Integer
Dim i As Integer
Dim c As Integer
Dim pc As String
Dim version As String
Dim password As String
code97(1) = &H86
code97(2) = &HFB
code97(3) = &HEC
code97(4) = &H37
code97(5) = &H5D
code97(6) = &H44
code97(7) = &H9C
code97(8) = &HFA
code97(9) = &HC6
code97(10) = &H5E
code97(11) = &H28
code97(12) = &HE6
code97(13) = &H13
code2k(1) = &HA1
code2k(2) = &HEC
code2k(3) = &H7A
code2k(4) = &H9C
code2k(5) = &HE1
code2k(6) = &H28
code2k(7) = &H34
code2k(8) = &H8A
code2k(9) = &H73
code2k(10) = &H7B
code2k(11) = &HD2
code2k(12) = &HDF
code2k(13) = &H50
filemdb = Dir1.Path & "\" & File1.FileName
Open filemdb For Binary As #1
str = Space$(1)
Get #1, &H14 + 1, str
ver = Val(Asc(str))
Get #1, &H62 + 1, str
encflag = Val(Asc(str))
str = Space$(26)
Get #1, &H42 + 1, str
Close #1
password = ""
If (ver < 1) Then
version = "Access 97"
c = Val(Asc(Mid$(str, 1, 1)))
If ((c Xor code97(1)) = 0) Then
password = "(none)"
Else
For i = 1 To 13
c = Val(Asc(Mid$(str, i, 1)))
password = password & Chr$(c Xor code97(i))
Next
End If
Else
version = "Access 2000,2002"
For i = 1 To 13
c = Val(Asc(Mid$(str, (i * 2) - 1, 1)))
If (i Mod 2 = 0) Then
pc = c Xor code2k(i)
Else
pc = &H13 Xor encflag Xor c Xor code2k(i)
End If
password = password & Chr$(pc)
Next
End If
MsgBox "File Name : " & File1.FileName & vbCr & _
"Version : " & version & vbCr & _
"Password : " & password, , "Password"
End Sub