VB6 Manifest not working on Windows 7

放肆的年华 提交于 2019-12-06 05:38:46

问题


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?


回答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




回答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.




回答3:


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>



回答4:


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


来源:https://stackoverflow.com/questions/4489165/vb6-manifest-not-working-on-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!