Overwrite executable file in C: \ Program \ MyProg in Windows Vista

I would like my program to be updated (by downloading a new exe and / or some other files from ftp), and I used the recipe in the accepted answer to this question . Summary:

  • Rename the running program to old-mp.exe
  • Download the update as mp.exe directly
  • Restart program

This works great for Windows XP. Vista has a problem because the user must run the program as an administrator in order for it to work. The right choice and the choice of "Run as administrator" may be higher than my users ... Does anyone know about this? I really like the simple update method.

+3
source share
1 answer

A simple option is to include a manifest that indicates that the application needs administrator rights. Then Vista will automatically offer an elevation of privilege. The manifest should look something like this:

<?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="ApplicationName" type="win32"/>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator"/> 
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly>

You can use the mt.exe tool to add it to an existing application.

Alternatively, you can restart the program with administrator rights immediately before the actual update. Thus, the user will not need to start with administrator rights always - only during the update.

+2
source

All Articles