OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Makes sure that all EXE and DLL files in the provided directory were built | 6 """Makes sure that all EXE and DLL files in the provided directory were built |
7 correctly. | 7 correctly. |
8 | 8 |
9 In essense it runs a subset of BinScope tests ensuring that binaries have | 9 In essense it runs a subset of BinScope tests ensuring that binaries have |
10 /NXCOMPAT, /DYNAMICBASE and /SAFESEH. | 10 /NXCOMPAT, /DYNAMICBASE and /SAFESEH. |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 PE_FILE_EXTENSIONS = ['.exe', '.dll'] | 23 PE_FILE_EXTENSIONS = ['.exe', '.dll'] |
24 DYNAMICBASE_FLAG = 0x0040 | 24 DYNAMICBASE_FLAG = 0x0040 |
25 NXCOMPAT_FLAG = 0x0100 | 25 NXCOMPAT_FLAG = 0x0100 |
26 NO_SEH_FLAG = 0x0400 | 26 NO_SEH_FLAG = 0x0400 |
27 MACHINE_TYPE_AMD64 = 0x8664 | 27 MACHINE_TYPE_AMD64 = 0x8664 |
28 | 28 |
29 # Please do not add your file here without confirming that it indeed doesn't | 29 # Please do not add your file here without confirming that it indeed doesn't |
30 # require /NXCOMPAT and /DYNAMICBASE. Contact cpu@chromium.org or your local | 30 # require /NXCOMPAT and /DYNAMICBASE. Contact cpu@chromium.org or your local |
31 # Windows guru for advice. | 31 # Windows guru for advice. |
32 EXCLUDED_FILES = ['chrome_frame_mini_installer.exe', | 32 EXCLUDED_FILES = ['mini_installer.exe', |
33 'mini_installer.exe', | 33 'next_version_mini_installer.exe' |
34 'next_version_mini_installer.exe', | |
35 'wow_helper.exe' | |
36 ] | 34 ] |
37 | 35 |
38 def IsPEFile(path): | 36 def IsPEFile(path): |
39 return (os.path.isfile(path) and | 37 return (os.path.isfile(path) and |
40 os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS and | 38 os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS and |
41 os.path.basename(path) not in EXCLUDED_FILES) | 39 os.path.basename(path) not in EXCLUDED_FILES) |
42 | 40 |
43 def main(options, args): | 41 def main(options, args): |
44 directory = args[0] | 42 directory = args[0] |
45 pe_total = 0 | 43 pe_total = 0 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 usage = "Usage: %prog [options] DIRECTORY" | 120 usage = "Usage: %prog [options] DIRECTORY" |
123 option_parser = optparse.OptionParser(usage=usage) | 121 option_parser = optparse.OptionParser(usage=usage) |
124 option_parser.add_option("-v", "--verbose", action="store_true", | 122 option_parser.add_option("-v", "--verbose", action="store_true", |
125 default=False, help="Print debug logging") | 123 default=False, help="Print debug logging") |
126 option_parser.add_option("--json", help="Path to JSON output file") | 124 option_parser.add_option("--json", help="Path to JSON output file") |
127 options, args = option_parser.parse_args() | 125 options, args = option_parser.parse_args() |
128 if not args: | 126 if not args: |
129 option_parser.print_help() | 127 option_parser.print_help() |
130 sys.exit(0) | 128 sys.exit(0) |
131 main(options, args) | 129 main(options, args) |
OLD | NEW |