#!/usr/bin/env python # By Daniel Pistelli & Nguyen Tan Cong # This script is to patch DLL/EXE MajorVersion to 5, # so they can be loaded by Windows XP. # This is the problem introduced by compiling on Windows 7, using VS2013. import sys, struct if len(sys.argv) < 2: print("Usage: %s " % sys.argv[0]) sys.exit(0) pe_file_path = sys.argv[1] with open(pe_file_path, "rb") as f: b = f.read() if not b.startswith("MZ"): print("Not a PE file") sys.exit(0) e_lfanew = struct.unpack_from("