WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Ed Lecuyer on September 12, 2014, 02:23:24 PM

Title: Man oh Manefests
Post by: Ed Lecuyer on September 12, 2014, 02:23:24 PM
Hi all,

Just got my upgrade to WinBatch + Compiler 2014B. Yey!

I currently use the method described in Article ID: W17428 to modify the manifest resource of the WinBatch executable.

Is there now a better way to embed my own manifests (added since WB2010?)

If not, what are the correct FixManSize and Offset values to use for WB2014B.

Thanks,

-Ed Lecuyer
Technical Product Manager, Terrain Navigator Pro
Proud WinBatch User and Advocate since 1997.
Title: Re: Man oh Manefests
Post by: td on September 12, 2014, 02:58:01 PM
The manifest starts somewhere close to byte offest 131586 and has a size of about 1294 bytes for 2014B.  The offset may not be exact but they should be close. You may have to experiment a bit.

You can find this information for yourself using the BinaryIndexEx functions to search a compiled script for the introductory '<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' string. You can find the size by searching for  the the last resource compiler inserted 'PADDINGPADDINGX' string.

It could be possible that at some time in the future we might size a manifest such that it falls exactly between resource segment boundaries but it is very unlikely that that would ever happen.  If it ever did happened the 'PADDINGPADDINGX' stings would not be present and you would have to search for the manifest terminating string '</assembly>'.
Title: Re: Man oh Manefests
Post by: Ed Lecuyer on September 15, 2014, 01:17:09 PM
I think I found the right settings
offset: 130292
size: 1291

That said, it would be much easier if we could add our own requirements to the application manifest, rather than having to hack them in post-compile. It would make WinBatch more flexible for those using it for application development in conjunction with external libraries.
Title: Re: Man oh Manefests
Post by: td on September 15, 2014, 04:44:38 PM
Using BinaryIndexEx I get the same offset for a 32-bit compilation but get 1292 for the size.  Of course the 64-bit compilation would produce different results.
Title: Re: Man oh Manefests
Post by: td on September 15, 2014, 09:54:21 PM
You may want to limit your manifest size to the size calculated by using the byte offset of the end of the '</assembly>' tag.  Have always assumed that the 'paddingpadingx' can be used by a manifest but have never tested that assumption.  The .rsrc section structures could be storing size limiting information for the #24 resource separate from the next resource and total .rsrc section size information.  If I ever get a free moment, I will have to poke around in the PE format's .rsrc section contents.
Title: Re: Man oh Manefests
Post by: td on September 15, 2014, 10:47:06 PM
That didn't take long.  It appears that the resource header does contain size information that does not include the padding between resource so it would be best to not use 'PADDINGPADDINGX' as part of the total manifest size.