Given a major and minor version of the MSVCR, returns the corresponding XML file.
(maj, min)
| 496 | log.warn('Cannot import msvcrt: using manifest will not be possible') |
| 497 | |
| 498 | def msvc_manifest_xml(maj, min): |
| 499 | """Given a major and minor version of the MSVCR, returns the |
| 500 | corresponding XML file.""" |
| 501 | try: |
| 502 | fullver = _MSVCRVER_TO_FULLVER[str(maj * 10 + min)] |
| 503 | except KeyError: |
| 504 | raise ValueError("Version %d,%d of MSVCRT not supported yet" % |
| 505 | (maj, min)) from None |
| 506 | # Don't be fooled, it looks like an XML, but it is not. In particular, it |
| 507 | # should not have any space before starting, and its size should be |
| 508 | # divisible by 4, most likely for alignment constraints when the xml is |
| 509 | # embedded in the binary... |
| 510 | # This template was copied directly from the python 2.6 binary (using |
| 511 | # strings.exe from mingw on python.exe). |
| 512 | template = textwrap.dedent("""\ |
| 513 | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
| 514 | <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> |
| 515 | <security> |
| 516 | <requestedPrivileges> |
| 517 | <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> |
| 518 | </requestedPrivileges> |
| 519 | </security> |
| 520 | </trustInfo> |
| 521 | <dependency> |
| 522 | <dependentAssembly> |
| 523 | <assemblyIdentity type="win32" name="Microsoft.VC%(maj)d%(min)d.CRT" version="%(fullver)s" processorArchitecture="*" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity> |
| 524 | </dependentAssembly> |
| 525 | </dependency> |
| 526 | </assembly>""") |
| 527 | |
| 528 | return template % {'fullver': fullver, 'maj': maj, 'min': min} |
| 529 | |
| 530 | def manifest_rc(name, type='dll'): |
| 531 | """Return the rc file used to generate the res file which will be embedded |