public static bool Is64BitRequiredExecutable(string path) { using (Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { IMAGE_DOS_HEADER image_dos_header = ReadHelper.ReadFromStream <IMAGE_DOS_HEADER>(stream); if (image_dos_header.e_magic != 0x5a4d) { throw new InvalidDataException(WrapperSR.GetString("InvalidAssemblyHeader", new object[] { path })); } stream.Position = image_dos_header.e_lfanew; IMAGE_NT_HEADERS image_nt_headers = ReadHelper.ReadFromStream <IMAGE_NT_HEADERS>(stream); if (image_nt_headers.Signature != 0x4550) { throw new InvalidDataException(WrapperSR.GetString("InvalidAssemblyHeader", new object[] { path })); } switch (image_nt_headers.FileHeader.Machine) { case 0x200: case 0x8664: return(true); } return(false); } }