With manifest, the VC++ application does not run on Windows XP virtual. What is the problem?

Hi,

I have found just recently, when testing the new version of our application, that it does not work on Windows XP (the Windows XP mode -- virtual machine created on Windows 7).  The application cannot be launched.  The message box appears with the full path of the application displayed, and it says that "The parameter is not correct" (or possibly "the argument" -- translated from another human language).  When the application is launched via the Total Commander, it displays the message box saying "Error executing program! (5)":

Message box with the error.
This happens since the application was compiled with VC++ 2008 or VC++ 2010.  When compiled with VC++ 2005, the application behaved as expected.

However, this behaviour is observed only on Win XP in the virtual mode (and could be possibly observed on Win XP with rather not so much applications intalled).  If the same application is launched on Win 7 with the development environment installed, no problem can be observed.

Trying hard to get the smallest application that behaves this way, I have discovered that the problem is in the manifest file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <description>APS Marketing 3</description>
    <!-- Identify the application security requirements (Vista): -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />
            </requestedPrivileges>
         </security>
    </trustInfo>
    <!-- Activate Windows Common Controls v6 usage (XP and Vista): -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity 
                type="win32" 
                name="Microsoft.Windows.Common-Controls" 
                version="6.0.0.0"
                processorArchitecture="X86" 
                publicKeyToken="6595b64144ccf1df" 
                language="*" 
            />
        </dependentAssembly>
    </dependency>
</assembly>

Open in new window


When the manifest file is removed from the project, the application works; however, the GUI is kind of less visually atractive (the Windows 2000 style both on Win XP and Win 7).

How can I fix the problem?

Thanks for your time and experience,
    Petr
LVL 29
peprAsked:
Who is Participating?
 
sarabandeCommented:
yes, you already told that in the original question.

it is somehow strange cause when the same manifest (file) worked with a vs2005 executable and didn't work with with a vs2008 executable, it should be that the manifest doesn't fit to the new executable and not other way round.

do you know how you created the manifest of vs2005?

can you run the vs2008 exectable with the vs2005 manifest (file) in Windows 7 ?

Sara
0
 
sarabandeCommented:
is the manifest file separately or embedded in the executable?

since VS2008 the manifest can be embedded what makes shipping much easier.

but embedding will not help for your problem. i would guess that the first component in the manifest is responsible for the fail because of comment

 '<!-- Identify the application security requirements (Vista): -->

which looks as it would fail at XP.

you might try to build in XP environment where you probably won't get that component included.

or you try to manually remove the potential "vista" component from manifest where you have to care to not work against the automatic build settings. it would be best if you could remove it in the properties in the manifest settings.

Sara

0
 
peprAuthor Commented:
The manifest file was added to the project resources and it was compiled to the binary form and embeded in the executable.  Exactly the same file was embeded by VC++ 2005, VC++2008, and VC++ 2009.  The executable compiled by VC++ 2005 runs fine everywhere, and the manifest manifests its functionality :)

The executable does not work only when the manifest was embeded by VC++ 2008 or 2010.

I believe that the '<!-- Identify the application security requirements (Vista): --> ' is treated as a normal XML comment, but I will try to remove it tomorrow.  The truth is that it could be doubled via information placed in the project property pages. The properties probably were not in VC++ 2005 and the part had to be created manually, if I recall correctly.  I am not sure if the VC++ 2005 embeded the information.  I will check it.

I have created the barebone code that shows the problem.  I will post it when I am in the office.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
sarabandeCommented:
when i used vs2005 last we had ported from vc6 and didn't embed the manifests. thanks for the information that embedding manifests already was a feature of vs2005.

i didn't mean to remove the comment but to remove the below component stored in the <trustinfo> block.

it is only a (weak) guess that this could be the reason. it also could be that invoking the assemblies requires more access rights that the vm will grant to the process. you also should consider that the main purpose of the xp vm was to run old programs with the old environment.

so you might not have the newest .NET at the vm.

Sara
0
 
peprAuthor Commented:
I am attaching the full project that produces the misbehaving applicaton.  The only activity is to display the message box and quit.  It is with the original manifest.  I also tried to remove the trustinfo element -- no difference.

test.zip

The application is the native one (no .NET), using ATL -- the stub linked statically.

The vm should be just a vm.  The XP mode should be just Windows XP, possibly without things that need not to be there.  However, the application should run also on computers with the Windows XP.  The one compiled with VS 2005 runs fine, the others compiled with 2008 and 2010 cannot be launched.  Unfortunately, I have no "clean" Windows XP that could be used for the test.
0
 
sarabandeCommented:
i will return home from customer site at friday and i think i will find time to check the program both in win7 64-bit (no xp vm) and on a native xp environment. however the systems are not "clean" as they both have vs2008 installed.

Sara
0
 
peprAuthor Commented:
Thanks Sara.  I have the Win 7 64-bit here (however with all the VS versions installed) and I have never observed any problem (with the full application).  I am quite curious if it the simple application works on XP.  The full application was not released yet, so I have no experience from cutomers and it is likely that it would be problematic.
0
 
peprAuthor Commented:
I was still not able to make it work -- nor here, nor through the related http:Q_27418374.html.

Can you point me to some tiny example with full sources and the project?  I would like to check, whether it works in my environments.

Thanks,
    Petr
0
 
sarabandeCommented:
i tried to open the project but as it was vs2010 i failed with vs2008.

Sara
0
 
peprAuthor Commented:
Thanks, Sara.  Here is the example for VS 2008 -- without the manifest.  It was created the same way as the same example at http:Q_27418374.html.  It works both in Win 7 (64-bit) and in the virtual XP mode.  The question now is how to add the enhanced GUI look (the manifest or whatever, to see the shaded button with round corners in both environments).  I was not successfull (I tried both the manifest and the #pragma way).  I must do something wrong, but I do not know what.
test2.zip
0
 
sarabandeCommented:
i will try this evening on my notebook.

when i lastly fought with manifests i got errors in event viewer. did you already check the eventvwr log?

Sara

0
 
peprAuthor Commented:
I have checked it, but it does not seem so.  No related event in the log (as far as I can say).
0
 
sarabandeCommented:
i built the project yesterday at Win7 with VS 2008. i think i got a non-shaded button (unfortunately i never have cared much about windows styles in the past) with the default manifest. when i put your manifest in a manifest file and tried to start the program i got start errors similar to yours but not error 5 (access denied) but msvcr90d.dll not found. so it seems i need to merge the manifests somehow rather than exchange the one by the other.

I will try to repeat the test on xp though i don't think that the results were better.

Sara
0
 
sarabandeCommented:
the output at xp looked ok for me but probably you will miss the styles, right?

 test2 at xp vs2008
Sara
0
 
peprAuthor Commented:
Yes, this is a logically correct output that can be obtained without the manifest.  No problem here, and it runs everywhere.  Now, how to add the manifest to enhance the look?
0
 
sarabandeCommented:
as i understand the manifest it should be output in the build phase. do you know what settings must be done to get the enhanced look? when i use a non-embedded manifest file with the contents you posted i can't start the program. that means that the components defined in the manifest were not suitable for the environment.

Sara
0
 
peprAuthor Commented:
Thanks Sara.  This is probably also the case when I embed the manifest.  It could be the case that it does not matter whether the manifest is embedded or not.  This is a good hint for me to try it with non-embedded manifest and experiment.

Another observation.  Incidentaly, I am working with unrelated somefile.scr -- nor executable at all, must be interpreted by my program.  When I tried to launch the file (by accident) from Total Commander, it showed the same error message.  From this I guess that the OS tries to execute it and the loader stops in some phase.  When having the manifest in the executable, it seems to behave the same way.  There must be some error in the manifest, so that it cannot continue loading.  My guess is that the manifest must be processed first to prepare some system information for the loaded executable (like to create the object for classes of the used windows in the application).
0
 
sarabandeCommented:
yes, the manifest is (can be) a substitute for former inifile. it also is a means to run a dll of a specific version cause you can put all registry information of a dll into manifest and so make your application independent of registry.

the main problem i have with all this, is that it is so little transparent and there are near to no information when the initialisation of a manifest failed.

so i would try to get a working manifest (generated?) from somewhere for a given environment rather than trying to find a manifest that works at all environments or even try to edit a manifest.  

Sara

0
 
peprAuthor Commented:
The problem is that the manifest that I use worked earlier (when the application was compiled by VC++ 2005).  It was a bit surprise for me to observe that it does not work in the newly tested environment.  The new environment is XP mode in Windows 7 64-bit (i.e. virtual machine with the Microsoft preinstalled Windows XP). The exact form of my manifest is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <description>APS Marketing 3</description>
    <!-- Identify the application security requirements (Vista): -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />
            </requestedPrivileges>
         </security>
    </trustInfo>
    <!-- Activate Windows Common Controls v6 usage (XP and Vista): -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity 
                type="win32" 
                name="Microsoft.Windows.Common-Controls" 
                version="6.0.0.0"
                processorArchitecture="X86" 
                publicKeyToken="6595b64144ccf1df" 
                language="*" 
            />
        </dependentAssembly>
    </dependency>
</assembly>

Open in new window

0
 
peprAuthor Commented:
Yes. When launched directly in Windows 7, it runs fine (even though it is 64-bit Windows and the application is 32-bit). No problem observed.  The problem is observed when the same application is launched on the same hardware but from withing the virtual machine with Windows XP (called "the Windows XP mode" -- the image of the virtual machine with the Win XP was downloaded directly from Microsoft).  I want to try some things next week. I will definitely report the results.  Thanks, Sara, for trying.
0
 
peprAuthor Commented:
Thanks, Sara, for trying to help.  I have to concentrate on other things these days.  I may return to the theme later.

Have a nice days,
  Petr
0
 
peprAuthor Commented:
For those interested, the problem was solved in http:Q_27563352.html.  The RT_MANIFEST ID must be 1, and the InitCommonControlEx() with ICC_STANDARD_CLASSES must be called.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.