Using the ElevateCreateProcess Fix
Published: June 11, 2010
Updated: June 11, 2010
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.
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
Open the Event Viewer console, and then browse to the Applications and Services Logs\Microsoft\Windows\UAC\Operational folder.
Double-click an error message from the Operational window.
The Event Properties dialog box appears.
Click the Details tab, and then click Friendly View.
The event details appear as a list, with the ProcessID provided beneath the Execution heading.
The following APIs are intercepted by the ElevateCreateProcess compatibility fix.
RegisterWaitForInputIdle, which is handled for use by subsequent calls to WinExec
The following table provides details for the available command-line option, including its usage.
Disables the Windows Vista run-level specification verification process and handles the ERROR_ELEVATION_REQUIRED call even if the application contains a manifest.
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.