Trouble embedding a manifest into a .exe

E

ejmichaud

I am having trouble embedding a manifest file into a .exe created
using Wise Script. When I use mt.exe (from Visual Studio 8 with SP1
installed) to embed the manifest file, the resulting file decreases in
size from 123KB to 23KB and without any surprise doesn't run.

I used the following commandline:
mt.exe -manifest Test1.exe.manifest -outputresource:Test1.exe

I also tried adding the manifest using Resource Hacker, file size
increases in size from 123KB to 124KB, however when I execute
Test1.exe I get the following error: "Could not initialize
installation. File size expected=168640121, size returned=126017"

Anyone have any ideas on how I can embed the manifest into a .exe
created from Wise Script?
 
S

Steve Easton

The embedded manifest will fail to execute if the file size of the manifest in bytes is not "exactly"
divisible by 4 "before" you compile it into a .res file.

Pad the manifest with spaces at the end until the file size is evenly divisible by 4.
Then compile it into a .res file and then import it using Resource Hacker.
 
E

ejmichaud

The embedded manifest will fail to execute if the file size of the manifest in bytes is not "exactly"
divisible by 4 "before" you compile it into a .res file.

Pad the manifest with spaces at the end until the file size is evenly divisible by 4.
Then compile it into a .res file and then import it using Resource Hacker.

Hi Steve, thanks for the response, still no luck but I may be doing
something wrong. Here is what I did:
1. I padded the manifest with spaces, had a size of 488 bytes.
2. I opened the .exe in Resource Hacker
3. I then selected "Add a new resource" from the Action pull down
menu
4. With the Add a new resource dialog open, selected the manifest
file I created (MyApp.exe.MANIFEST)
5. Set Resource Type to: 24
6. Set Resource Name to: 1
7. Set Resource Language to: 1033
8. Saved the file

When I run the .exe I get "Could not initialize installation. File
size expected=1869181810, size returned=126006

I do something wrong? Any other ideas?
 
E

ejmichaud

I found the solution, someone guided me to the answer on the Altiris/
Wise forums. By embedding the manifest into stub32.exe, code I then
compile results with the same manifest I embedded into stub32.exe. I
could not use mt.exe to embed the manifest into stub32.exe but I was
able to do it using resource hacker in the following manner:
1. I opened the stub32.exe in Resource Hacker
2. I then selected "Add a new resource" from the Action pull down
menu
3. With the Add a new resource dialog open, selected the manifest
file I created (MyApp.exe.MANIFEST)
4. Set Resource Type to: 24
5. Set Resource Name to: 1
6. Set Resource Language to: 1033
7. Compiled the script
8. Saved the stub32.exe file

Now anything I compile with Wise Script Editor now has the
MyApp.exe.MANIFEST embedded into the .exe. Thanks for the assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top