How to elevate rights programmatically for the application in Windows 7
Posted on 2010-08-18
Our C++ application (native, unmanaged code) checks whether some essential DLLs are registered. If not, it tries to register them. In other words, the automatic registration must be done when the application is executed for the first time. Second and next times this is not to be repeated.
The application is installed by copying to certain directory (no installer yet).
The situation is complicated on Windows Vista or Windows 7 because even the administrator must explicitly elevate the rights. Currently, he or she can do it during launching the application via right-click on the app icon and choosing the "Run as administrator". However, it is not convenient and we have to explain it again and again to the users who install the application.
My question is: Can the application elevate the right automatically when it decides so? I understand that it should not be done silently -- the UAC warning is OK in this case, no problem.