- The User Account Control in Windows Vista (and later)
- The redirection
- Redirection of the files
- Redirection of the registry
- How to elevate the privileges granted to a user
- Impact of UAC on the WINDEV applications
- Groups of functions that may be affected by the UAC mechanism
The UAC mechanism in Windows Vista (and later)
To increase the security of workstations against worms and viruses, starting with Windows Vista, the UAC (User Account Control) mechanism has been implemented.. By default, this mechanism considers that all the users (including the administrators) are standard users with reduced rights. To run an application that requires additional rights, the UAC mechanism asks for confirmation.
This help page briefly presents the UAC mechanism. See the online help of Windows (Vista or later) for more details.
The User Account Control in Windows Vista (and later)
Two types of accounts are available in Windows:
- the administrator account, that has all rights and privileges for managing a computer.
- the standard user account, which has limited rights and privileges.
The UAC reduces the potential of an attack by malicious software. All the users (including the administrators) have a limited account by default. The users can temporarily elevate their privileges when they need to run administrative or setup tasks.
By default, the administrators run most of the tasks by using standard user privileges. When they need to perform an administrative task, they must give their consent in a window that is displayed:
Remark: The aspect of this window depends on whether the executable is signed or not.
The elevated privileges are only granted for the duration of the process execution. All the other tasks are performed with the standard user account.
The UAC ensures that:
- all the users use the standard privileges by default.
- an explicit approval must be given to elevate a privilege.
- a high level of compatibility is guaranteed for the existing applications.
If a user tries to write into the registry (HKEY_LOCAL_MACHINE\SOFTWARE key) or into a system directory without having the necessary rights, Windows automatically redirects these write operations. A redirected information written by a program can be read by this program.
This redirection is performed per user: if an application that uses the redirection mechanism is started by two different users, these applications will not be able to exchange information.
This redirection is performed only if the user does not have the necessary administrator rights to perform this operation.
- This redirection is performed to ensure the compatibility of the applications because an application for Vista, Windows 7 or Windows 2008 should not write into these directories. The support for this redirection may not be available in the forthcoming versions of Windows.
- This redirection is performed for the 32-bit applications (and not for the 64-bit applications).
Redirection of the files
If an application writes into one of the system directories (Windows, Program Files, ...), this write operation will be performed only if the user has sufficient rights (administrator). Otherwise, Windows redirects the write operation to a directory specific to the user.
Redirection of the registry
If an application writes into the HKEY_LOCAL_MACHINE\SOFTWARE key, this write operation will be performed only if the user has sufficient rights (administrator). Otherwise, Windows redirects the write operation to the HKEY_CURRENT_USER\Software\Classes\VirtalStore\MACHINE\SOFTWARE key.
How to elevate the privileges granted to a user
By default, when running an executable, the system uses the following elements to define whether the executable requires specific privileges:
- the presence of a manifest file explicitly specifying the rights required by the applications
- the options checked in the properties of the executable
- the executable name (executables containing specific keywords in their name or description)
- the content of the executable
- whether the executable ended properly or not when it was previously run.
The user can elevate their privileges via one of the following operations:
- Right-click the executable and select "Run as administrator".
- Select "Run this program as administrator" in the "Compatibility" tab of the executable properties.
- Use a manifest that specifies the rights required by the executable. This solution is proposed by WINDEV. When creating the executable, you have the ability to include a manifest in your executable.
- The executables that require an elevation of privileges are displayed in Windows with a shield over the executable icon.
- Windows can automatically request an elevation of privileges if it detects that the program is a setup program.
- Caution: When starting an application with "Administrator" privileges, the network connections are lost. It is a security otion of Windows linked to the UAC: The network drives are disconnected when the user privileges are elevated. To keep on using them, they must be specifically reconnected. To do so, use NetworkConnect.
NetworkConnect("S:","\\Server\share", "user", "password")
Remark: The user and password parameters must necessarily be specified in this case because Windows considers that the user changed.
Impact of UAC on the WINDEV applications
- The UAC has no impact if an application runs properly in Windows XP for a standard user.
- If an application requires administrator privileges, a manifest must be included in the executable (requesting the administrator privileges).
- If the redirection affects or changes the behavior of the application, a manifest must be included in the executable (requesting the administrator privileges).
Reminder: WINDEV allows you to include a manifest when creating the executable.
Groups of functions that may be affected by the UAC mechanism
The following functions (or groups of functions) can be affected by the UAC mechanism (reminder: the UAC mechanism is enabled by default in Windows Vista (and later):
This list is not an exhaustive list.
: To create/modify a file without having the administrator privileges, we advise you to comply with the programming standard of Windows Vista (and later). For more details, see Programming standard for Windows Vista
Click [Add] to post a comment