4

I have created a manifest file for a VB6 application that is running on Windows 7 (not for any visual style changes, just to make sure it accesses the common registry and not a virtualised one)

The exe name is Capadm40.exe, the manifest is named Capadm40.exe.manifest and contains the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="CompanyName.Capadm40"
     type="win32"/>
  <description>Administers the System</description>
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

However, this doesn't seem to make any difference. ie the application is still using the virtualised registry hive. What is also strange is the after I unticked the 'Run this program as an administrator' option in the properties of the application exe, windows still shows a shield on the application icon, leading my to think this is some issue with my windows installation rather than a fault with the manifest. Any ideas?

Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
  • If it has the shield on the exe, surely it prompts for elevation when you run it? And in that case, it would not get virtualization, at least not UAC virtualization. Before trying to deal with your manifest issues, are you really truly sure it's writing to the virtualized hive locations? – Kate Gregory Dec 20 '10 at 12:27
  • It isn't asking for elevation and it shouldn't (I think the icon showing a shield must be a windows bug of some sort) because when it runs it is using a virtualised registry because the path to the data is different to when I right click and runas Administrator. The issue is that the manifest seems to have no effect (even if I changed the level to requireAdministrator) – Matt Wilko Dec 20 '10 at 13:28
  • Is the manifest definitely valid? e.g. is it UTF-8 encoded? – MarkJ Dec 20 '10 at 16:24
  • Yes this was something I checked out to start with as some text editors changed the encoding transparently in the background – Matt Wilko Jan 06 '11 at 16:09

4 Answers4

2

You're probably running afoul of the fusion cache (and the Explorer Shell's icon cache). External manifests are strongly discouraged anyway, but trying to add one after the program has previously been run often leads to such symptoms.

See Manifest and the fusion cache for a brief description.

You could also touch the EXE to reload the cache.

Bob77
  • 13,167
  • 1
  • 29
  • 37
  • This seems to be exactly the scenario I was seeing - changes to the external manifest seemed to make no difference, then all of a sudden it would work for no apparent reason - now I know why! – Matt Wilko Dec 21 '10 at 10:11
1

I would take advantage of LaVolpe's manifest creator, works great for XP, Vista and 7: http://www.vbforums.com/showthread.php?t=606736

Joe Jordan
  • 2,372
  • 2
  • 17
  • 20
  • I have tried using Make My Manifest previously but it crashed when I opened two of my projects so I took a sharp u-turn, this tool seems to work well though. Thanks – Matt Wilko Dec 21 '10 at 10:09
  • 1
    A further note to anyone stumbling upon this - Nearly 18 months later; I have used this manifest creator for many VB6 projects and it has worked without a hitch. – Matt Wilko May 03 '12 at 08:05
0

I have only found one manifest that works across all platforms 9x+. or even works at all. I have tried all the examples, articles, etc.

the version number or anything else added to it will kill it. possible exception is the extra parameter on requestedExecutionLevel, that seems to be OK. you can change level, and you can add uiAccess. those are allowable. after a LOT of binary-count testing, I found out that those cute extra features of manifests that microsoft offers simply make windows give various errors.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
        <ms_asmv2:security>
            <ms_asmv2:requestedPrivileges>
                <ms_asmv2:requestedExecutionLevel level="asInvoker">
                </ms_asmv2:requestedExecutionLevel>
            </ms_asmv2:requestedPrivileges>
        </ms_asmv2:security>
    </ms_asmv2:trustInfo>
</assembly>
Jim Michaels
  • 669
  • 5
  • 9
-1

Applying the styles in the VB6 IDE:

Save this text in a file named vb6.exe.manifest in the same folder as the vb6.exe:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="Microsoft.VisualBasic.IDE"
    type="win32"
/>
<description>Visual Basic 6 IDE</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>   

Add spaces in the file end until it reaches 672 bytes (multiple of 4).

Then:

  1. download the Resource Hacker and open it as administrator
  2. File > open the VB6.exe
  3. File > New blank script
  4. type: 1 24 "vb6.exe.manifest"
  5. Compile script
  6. Save
Bernardo Ramos
  • 4,048
  • 30
  • 28