Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This
issue applies to the version of mt.exe that ships in the newly released Microsoft
Windows SDK for Windows 7 and .NET Framework 3.5 SP1: BETA.
Issue:
The use
of mt.exe to add a manifest resource to a PE image file (.EXE, .DLL, etc.) that
does not already contain a resource (.rsrc) section in it may fail on Windows 7
Beta. The problem does not occur on Windows XP, Windows Vista, and
Windows Server 2008, nor does it occur on Windows 7 Beta when manipulating PE
image files that already contain a resource section.
Workarounds:
1. Use
mt.exe on Windows XP, Windows Vista or Windows Server 2008 instead of Windows 7
Beta, or
2. If using
Windows 7 Beta, use an external manifest file or ensure the PE image has a
non-zero length resource section.
a. External
Manifest File:
For .EXE files, the manifest need not be embedded as a resource. Rather,
it may simply be placed next to the .EXE. I.e., for ‘hello.exe’, the
manifest ‘hello.exe.manifest’, when placed next to it, has the same effect as
if the manifest were embedded as a resource. This is true only for .EXE
files.
b. Create a
Non-Zero-Length Empty Resource Section:
If it is imperative that mt.exe later be used to embed a manifest, and
the PE image file in question cannot otherwise be guaranteed to have a resource
section, then an empty resource script may be used. Despite that the script
is empty, the resultant resource section will not be zero-length, and mt.exe
can then be used. For example:
i. cl.exe /c
hello.c
ii. echo.
> hello.rc
iii. rc.exe /r
hello.rc
iv. link.exe
/out:hello.exe hello.obj hello.res
v. mt.exe
-outputresource:hello.exe;1 -manifest: hello.exe.manifest
vi. (the file
hello.exe now exists with hello.exe.manifest embedded)