共用方式為


Using the RunAsAdmin Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the RunAsAdmin compatibility fix, including the associated issues and usage.

RunAsAdmin

The RunAsAdmin compatibility fix causes an application to require administrator privileges. It will also cause the User Account Control (UAC) elevation prompt to appear if the current context is not already elevated. The RunAsAdmin fix overrules both installer detection and manifest processing, and it will determine the elevation state for the entire application after it is applied.

Warning

The RunAsAdmin compatibility fix should be applied only after you have tried all of your other options, such as investigating the application by using the Standard User Analyzer tool, which is provided with the Application Compatibility Toolkit (ACT), or if the application was clearly designed to administer the computer.

Investigating the Issue

The RunAsAdmin compatibility fix should be considered as a possible resolution if the application works properly when you right-click the executable (.exe) file, and then click Run as administrator.

Intercepted APIs

None. This compatibility fix does not intercept any APIs. Instead it applies a loader flag to the application.

Fixing Your Code

If you are fixing an application that performs administrative tasks on the computer, then you can remedy this issue by creating a manifest that includes the desired run-level (requireAdministrator). If, however, you are fixing an application that incorrectly requires administrator rights, you should fix this issue by removing that requirement and allowing the application to run as a Standard User. To do this, you can use the Standard User Analyzer, which comes with the ACT, to identify and modify the areas in the code that require administrator rights.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems