How can I achieve this? Suppose a user installs my software in C:\Program Files (x86) or any other location. If that location requires UAC, then the UAC prompt appears and the user installs the app. But if the location does not require UAC, the prompt does not appear.
Currently, I have to manually check which locations require UAC permission and which do not. Is there any InstallAware feature that can automatically detect whether UAC is required and show the prompt accordingly?
UAC Elevation
Re: UAC Elevation
That's an excellent question!
There's no standard API in Windows to determine whether a folder is "protected by UAC", because folders have permissions and UAC just happens to be the way to elevate your application so it has the appropriate permissions.
In other words, UAC and folder protection aren't, quite exactly, directly related.
Furthermore, there's well-known folders which require Administrator permissions (ex: %programfiles%), and other well-known folders which don't (ex: %userprofile%). These are a matter of the public record, and would hardly change from one installation of Windows to another (especially since you have the Get Folder Location command, which returns those folder paths in a system and language agnostic way).
$TARGETDIR$, for example, defaults to your %userprofile% folder in InstallAware Multi Platform - whereas in InstallAware X17, it defaults to %programfiles%.
With those preliminaries that actually lay out the important conceptual foundations for us here, the actual answer to your question is trivially easy:
I would use the Write to Text File and Read from Text File to test any given path. If you're able to write successfully while running non-elevated, there is no "UAC protection" over that folder.
There's no standard API in Windows to determine whether a folder is "protected by UAC", because folders have permissions and UAC just happens to be the way to elevate your application so it has the appropriate permissions.
In other words, UAC and folder protection aren't, quite exactly, directly related.
Furthermore, there's well-known folders which require Administrator permissions (ex: %programfiles%), and other well-known folders which don't (ex: %userprofile%). These are a matter of the public record, and would hardly change from one installation of Windows to another (especially since you have the Get Folder Location command, which returns those folder paths in a system and language agnostic way).
$TARGETDIR$, for example, defaults to your %userprofile% folder in InstallAware Multi Platform - whereas in InstallAware X17, it defaults to %programfiles%.
With those preliminaries that actually lay out the important conceptual foundations for us here, the actual answer to your question is trivially easy:
I would use the Write to Text File and Read from Text File to test any given path. If you're able to write successfully while running non-elevated, there is no "UAC protection" over that folder.
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installaware-multi-platform.htm
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installaware-multi-platform.htm
Who is online
Users browsing this forum: No registered users and 124 guests