document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //In ASCII representation, 0x5A4D is MZ, the initials of Mark Zbikowski, one of the original architects of MS-DOS.
  2. static bool CheckIsExecutable(string filePath)
  3.         {
  4.             //There\'s a #define for this value, named IMAGE_DOS_SIGNATURE.            
  5.             var firstBytes = new byte[2];
  6.             using (var fileStream = File.Open(filePath, FileMode.Open))
  7.             {
  8.                 fileStream.Read(firstBytes, 0, 2);
  9.             }
  10.             return Encoding.UTF8.GetString(firstBytes) == "MZ";
  11.         }
');