/ Published in: C#

A function to check the first two bytes to see if they match "MZ" marking it as an executable.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
bool CheckIsExecutable(string filePath) { using(var fileStream = File.Open(filePath, FileMode.Open)) { fileStream.Read(firstBytes, 0, 2); } return Encoding.UTF8.GetString(firstBytes) == "MZ"; }
Comments
