Using the ElevateCreateProcess Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the ElevateCreateProcess compatibility fix, including the associated issues, intercepted APIs, the available command-line option, and usage.

ElevateCreateProcess

Windows Vista added a new return code, ERROR_ELEVATION_REQUIRED, to the CreateProcess APIs. Applications that were designed prior to the release of Windows Vista do not know to look for this new code.

The ShellExecute APIs will handle this code on behalf of the caller, call into the Application Information Service, and then prompt for elevation, enabling the application to work properly. However, the CreateProcess APIs will not perform this same process and will fail. The ElevateCreateProcess fix addresses this issue by handling the ERROR_ELEVATION_REQUIRED error code, and then attempting to start the application with elevated permissions. If an application includes a manifest that specifies a run level for Windows Vista, then the error code will not be handled and the application will simply fail.

Investigating the Issue

Application-related issues that can be resolved by applying the ElevateCreateProcess compatibility fix only appear when a new process is created. For example, the fix would be triggered if an application attempts to start another application, such as when an application update is implemented as a separate EXE file.

The elevation failures are recorded in the Applications and Services Logs\Microsoft\Windows\UAC\Operational section of the Event Viewer, with a new entry being added each time the ERROR_ELEVATION_REQUIRED error code is not properly handled. The Details tab of the event entry includes a ProcessID for the process that encountered the error, which you can then correlate with the process ID of the running applications, as shown in the Processes tab of the Task Manager.

To locate the ProcessID in the Event Viewer

  1. Open the Event Viewer console, and then browse to the Applications and Services Logs\Microsoft\Windows\UAC\Operational folder.

  2. Double-click an error message from the Operational window.

    The Event Properties dialog box appears.

  3. Click the Details tab, and then click Friendly View.

    The event details appear as a list, with the ProcessID provided beneath the Execution heading.

Intercepted APIs

The following APIs are intercepted by the ElevateCreateProcess compatibility fix.

  • CreateProcessA

  • CreateProcessW

  • WinExec

  • RegisterWaitForInputIdle, which is handled for use by subsequent calls to WinExec

Command-Line Options

The following table provides details for the available command-line option, including its usage.

Option Description
NoManifestCheck

Disables the Windows Vista run-level specification verification process and handles the ERROR_ELEVATION_REQUIRED call even if the application contains a manifest.

Included Module

The ElevateCreateProcess compatibility fix includes the msvbvm60.dll module.

Fixing Your Code

Applications should be modified to use the ShellExecute APIs, because they correctly handle this elevation error and are more robust at error handling for future issues.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems