Using the RetryOpenSCManagerWithReadAccess Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the RetryOpenSCManagerWithReadAccess compatibility fix, including the issue details, the intercepted APIs, and the recommended fix for a permanent solution.

RetryOpenSCManagerWithReadAccess

RetryOpenSCManagerWithReadAccess fixes an issue whereby an application attempts to open the Service Control Manager with more privileges than required.

This compatibility fix intercepts the ERROR_ACCESS_DENIED returned value and then retries the call by requesting fewer rights, specifically for:

  • SC_MANAGER_CONNECT

  • SC_MANAGER_ENUMERATE_SERVICE

  • SC_MANAGER_QUERY_LOCK_STATUS

  • STANDARD_RIGHTS_READ

Investigating the Issue

Application-related issues that can be resolved by applying the RetryOpenSCManagerWithReadAccess fix are typically detected by using the Standard User Analyzer (SUA) tool, which is provided by the Application Compatibility Toolkit (ACT). SUA can detect if there are issues with the OpenSCManager API call. However, it does not include automatic fixes for this issue.

Intercepted APIs

The RetryOpenSCManagerWithReadAccess compatibility fix intercepts the OpenSCManagerA API.

Fixing Your Code

Applications should be modified to demand only the minimal amount of permissions required for an action. This modification can be done by changing the call to the OpenSCManagerA API.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems