Free Trial Software Downloads Resource Tuner - Win32 resource editor, more...
Heaventools Home
 

home      products      solutions     news     downloads     order     support     about us

 

 
Resource Tuner Tutorials & How-to's
 

 

How to run as Administrator

Tell Vista to run the application elevated

Developers need a way to deploy the same build of the application on both Windows Vista and Windows XP. However, a new feature of Windows Vista, User Access Control (UAC) causes processes to run as standard user even if you are logged in with a user that is the member of the Administrators group.

If your application needs administrative privileges, and you want it to run elevated as an administrator, you have to modify your current manifest, or create an application manifest for your application that tells Vista to run the application elevated.

Resource Tuner allows you to patch a pre-existing binary exe to inject the Require Administrator info into it so that it would be forced to run as Administrator on Windows Vista, providing the application the same operational behavior as in Windows XP. A modified exe should still work correctly on prior Windows operating systems.

Adding the TrustInfo Section

Microsoft has implemented an extension to the trustInfo section of the current Windows XP application manifest schema. These new attributes indicate to the system that you have a legitimate administrative application. The system will automatically ask for approval from the user to launch the application with full privileges.

1. Expand the Manifest folder that is found in the Resource Tree view; select the Manifest resource to be edited in the Resource Tree.

Select the Manifest resource to be edited

2. You will see the XML script. It may 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
    name="Microsoft.Windows.SomeApp"
    processorArchitecture="x86"
    version="5.1.0.0"
    type="win32"/>
<description>Windows Shell</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
           type="win32"
           name="Microsoft.Windows.Common-Controls"
           version="6.0.0.0"
           processorArchitecture="x86"
           publicKeyToken="6595b64144ccf1df"
           language="*"
        />
     </dependentAssembly>
  </dependency>
</assembly>

3. The important thing to note is that there should be no trustInfo statement in this manifest at this time.

4. Now we are going to insert the trust info into this manifest. Press the Resource Editor button to edit a selected manifest. Or simply double-click the resource item directly.

Press the Resource editor button to edit a selected manifest

5. Insert (copy and paste) the TrustInfo section into the manifest:

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

<!-- Identify the application security requirements. -->
<!-- level can be "asInvoker", "highestAvailable", or "requireAdministrator" -->

   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
      </requestedPrivileges>
    </security>
   </trustInfo>


</assembly>

6. Press OK to close the Resource Editor and select File -> Save File As to save the changes you've just made to the target file. If warned that the image size has changed, click Yes to update the file size.

It is recommended to perform all file operations with copies of the originals and then only after you have moved the copies to a separate directory other than the parent or home directory of the executable.

Tutorials      
back home 

 


Take a look at  Resource Tuner Screenshots

Buy Now Personal License ... US$39.95
Business License ... US$79.95

Download a 30 day trial version of ResTuner    How to Order

     

Home  •   Site Map  •   Purchase  •   Downloads  •   Support  •   F.A.Q.  •   Forum  •   About