The following code does not require a component to get the MD5 value.
Copy Code code as follows:
Option Explicit
Dim WI
Dim file
Dim file_size
Dim file_attributes
Dim file_version
Dim File_hash
Set WI = CreateObject ("Windowsinstaller.installer")
File = "111.exe"
File_size = wi. FileSize (file)
File_attributes = wi. FileAttributes (file)
File_version = wi. FileVersion (file)
File_hash = Getfilehash (file)
Set WI = Nothing
MsgBox "File:" & File & VbCrLf & _
"Size:" & File_size & VbCrLf & _
"Attributes:" & File_attributes & VbCrLf & _
"Version:" & File_version & VbCrLf & _
"MD5:" & File_hash
Function Getfilehash (file_name)
Dim File_hash
Dim Hash_value
Dim I
Set File_hash = wi. Filehash (file_name, 0)
Hash_value = ""
For i = 1 to File_hash. FieldCount
Hash_value = Hash_value & Bigendianhex (File_hash. Integerdata (i))
Next
Getfilehash = Hash_value
Set File_hash = Nothing
End Function
Function Bigendianhex (INT)
Dim result
Dim B1, B2, B3, B4
result = Hex (Int)
B1 = Mid (result, 7, 2)
B2 = Mid (Result, 5, 2)
B3 = Mid (result, 3, 2)
B4 = Mid (result, 1, 2)
Bigendianhex = b1 & b2 & B3 & B4
End Function