The MASM Forum Archive 2004 to 2012

Specialised Projects => Compiler Based Assembler => Assembler With Microsoft Visual C => Topic started by: hutch-- on January 22, 2011, 12:49:50 AM

Title: VC 2003 template with manifest and version control block.
Post by: hutch-- on January 22, 2011, 12:49:50 AM
I recently did a test build on a C template I keep around and it went from 4.5k to 30k (WTF mutter etc ....) and the problem traced down to using the wrong version of MSVCRT in the LIB directory. Added the version fom VC98 and it came back down in size again. Added a manifest and a version control block in the RC file which brought it up to 5.5k and to see if I could still remember how to write a function I added a MessageBoxIndirect() function. Window self centers, it has a basic menu and the version control block works correctly on XP.

For any interested the VC98 version of MSVCRT is attached in the zip file. Legally it is a redistributable so you should have no problems using it in an app.
Title: Re: VC 2003 template with manifest and version control block.
Post by: dedndave on January 22, 2011, 01:00:53 AM
which version yielded the 30 Kb file ?   :eek
Title: Re: VC 2003 template with manifest and version control block.
Post by: hutch-- on January 22, 2011, 02:03:06 AM
 :bg

Any version that did not use the old VC98 MSVCRT. The problem is the standard C runtime library. If you don't have the right version of MSVCRT it pulls the maths functions used with divide "/" out of the main runtime and you get all of the startup code as well.

Class the VC98 MSVCRT as a DOWNdate as against an UPdate.  :P
Title: Re: VC 2003 template with manifest and version control block.
Post by: Vortex on January 22, 2011, 11:13:13 AM
Hi Hutch,

I had to remove the manifest file as the menu items does not display the message box in the original executable. Also, I removed the msvcrt.lib dependency and the executable's size is reduced now to 5632 bytes.

About the mathematical operation, I extracted the object module containing the __ftoll function from Pelles C static library crt.lib. Running Polib with the /explode option extracts all the library members.


pocc.exe /Ze /Zx /Zl /Ot Project2.c
polink /SUBSYSTEM:WINDOWS /entry:main Project2.obj Rsrc.res kernel32.lib user32.lib _ftoll.obj


Project built with Pelles C 6.50 RC3

OS : XP Service Pack 3
Title: Re: VC 2003 template with manifest and version control block.
Post by: hutch-- on January 23, 2011, 09:05:34 PM
Thanks Erol, thats an interesting effect, I still develop on XP SP3 and the message boxes all work correctly here. I had it building at 4.5k without the manifest and version control block but added them both to try and make it easier to recognise on Vista and Win7.
Title: Re: VC 2003 template with manifest and version control block.
Post by: Antariy on January 23, 2011, 11:53:46 PM
Quote from: Vortex on January 22, 2011, 11:13:13 AM
I had to remove the manifest file as the menu items does not display the message box in the original executable.

There is problem with some XP systems and programs which have manifest, but actually is not importing comctl32.dll
Anything app which uses manifest, then this app should be statically (implicitly) linked to the comctl32.dll.
This is done if called anything function from comctl32.dll. If no any functionality comctl32.dll is required, then needed to call InitCommonControls at least.
Title: Re: VC 2003 template with manifest and version control block.
Post by: Vortex on January 24, 2011, 06:29:09 PM
Hi Antariy,

Thanks for the info. I added a call to InitCommonControls and this solved the issue.
Title: Re: VC 2003 template with manifest and version control block.
Post by: GregL on January 26, 2011, 04:04:22 AM
Alex,

Is that documented somewhere?

Title: Re: VC 2003 template with manifest and version control block.
Post by: Antariy on January 26, 2011, 01:16:29 PM
Quote from: GregL on January 26, 2011, 04:04:22 AM
Alex,

Is that documented somewhere?

Not sure about documentation. Probably it should be documented somewhere at MS.COM
Title: Re: VC 2003 template with manifest and version control block.
Post by: hutch-- on January 28, 2011, 12:49:41 AM
Juadst added Alex's suggestion, included the common control library and made a call to InitCommonControls() and it builds fine here on my US English version of XP SP3.
Title: Re: VC 2003 template with manifest and version control block.
Post by: Vortex on January 28, 2011, 06:54:25 PM
Hi Hutch,

The new version works fine.
Title: Re: VC 2003 template with manifest and version control block.
Post by: hutch-- on January 30, 2011, 12:29:23 AM
Thanks Erol.