Jump to content

Trouble embedding a manifest into a .exe


Recommended Posts

Guest ejmichaud@hotmail.com
Posted

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?

  • Replies 3
  • Created
  • Last Reply
Guest Steve Easton
Posted

Re: Trouble embedding a manifest into a .exe

 

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.

 

--

 

Steve Easton

 

 

<ejmichaud@hotmail.com> wrote in message news:1185289884.404417.64470@q75g2000hsh.googlegroups.com...

>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?

>

Guest ejmichaud@hotmail.com
Posted

Re: Trouble embedding a manifest into a .exe

 

On Jul 24, 4:56 pm, "Steve Easton" <ad...@95isalive.com> wrote:

> 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?

Guest ejmichaud@hotmail.com
Posted

Re: Trouble embedding a manifest into a .exe

 

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...