1
votes

I have a VB6 legacy application that is normally installed in C:/Program Files/Application Name

This means that under Win7 and 8 it is subject to UAC Virtualization controls. As some users find the seeming absence of files confusing I would like to avoid the UAC Virtualization. If I were to install the application in another directory, such as

C:/My Application/AppName

which is separate from Program Files, would this avoid the UAC Virtualization or would it still occur?

Thank you

1
Better to use "ProgramData" folder for your application eg. `C:\ProgramData\YourApplication` - Bhavesh G
+1 Bhavesh. More explanations and code in this question - MarkJ
possible duplicate of Prevent UAC Virtualization? - MarkJ

1 Answers

2
votes

Your best solution is to install the application in:

%LOCALAPPDATA%\ClintonSoft

e.g.

C:\Users\Clinton\AppData\Local\ClintonSoft

That is a folder that a user is allowed to modify.

Or you can turn off virtualization

You can opt-out of File and Registry Virtualization. You do this by adding an entry to your assembly manifest by indicating requestedExecutionLevel of asInvoker:

<?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="client"
            type="win32"
    /> 

    <description>Clinton's Reilly Factor</description> 

    <!-- Disable file and registry virtualization -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker"/>
            </requestedPrivileges>
        </security>
    </trustInfo> 

</assembly>

Warning

By opting out of File and Registry virtualization , your application will fail with the exact same ACCESS_DENIED errors you would get on Windows XP.