Hi @Peter Volz ,
According to the wiki List of file signatures, the Magic number of WIM filr type is 4D 53 57 49 4D 00 00 00 D0 00 00 00 00 .
Function IsWimFile(filename As String) As Boolean
Dim magicNumber As Byte() = {&H4D, &H53, &H57, &H49, &H4D, &H0, &H0, &H0, &HD0, &H0, &H0, &H0, &H0}
Try
Using fileStream As New FileStream(filename, FileMode.Open, FileAccess.Read)
Dim header(magicNumber.Length - 1) As Byte
fileStream.Read(header, 0, header.Length)
Return header.SequenceEqual(magicNumber)
End Using
Catch ex As Exception
Console.WriteLine("An error occurred: " & ex.Message)
Return False
End Try
End Function
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.