Hi @Peter Volz ,For Win16 executable files, known as New Executable, they also use MZ as the file header, so MyBinaryReader.ReadUInt16() = 23117
should also works for NE file.
New (NE), linear (LX), and portable (PE) executables retain the DOS MZ format file header for [backward compatibility](https://en.wikipedia.org/wiki/Backward_compatibility"Backward compatibility") with DOS.
Try
Dim MyBinaryReader As New BinaryReader(InputStream)
Dim mzSignature As UInt16 = MyBinaryReader.ReadUInt16()
If mzSignature = &H5A4D Then ' Check for MZ signature
MyArchitecture = 16 ' This is an MZ (DOS) file
ElseIf mzSignature = 23117 Then ' Check for NE signature
MyArchitecture = 16 ' This is an NE (16-bit New Executable) file
Else
InputStream.Seek(0, SeekOrigin.Begin) ' Reset stream position
Dim peSignature As UInt32 = MyBinaryReader.ReadUInt32()
If peSignature = 17744 Then ' Check for PE signature
MyArchitecture = 32 ' This is a PE (Portable Executable) file
End If
End If
Catch Exception As Exception
End Try
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.