Application2 was orginally developed an application for WinXP. Now I have to contend with User Account Control (UAC) on Win7. The Application2 runs fine on Win7 as long as the user is logged into an Administrator account and they select "Run as administrator." However, I am trying to evaluate whether it is possible to refractor Application2 so that it does not require an Administrator account and "Run as administrator." I would also like to avoid any dialog boxes requiring users to make a choice if possible.
Application2 features that currently require "Run as administrator"
- Create System Data Sources (ODBC)
- Read/write/delete registry keys
- Copy/delete files in
C:\Program Files\MyApp
- Encypt/decrypt files in
C:\Program Files\MyApp
- Start .exe processes located in a shared folder on a remote machine
- Start VBScript processes that install Office Add-ins and read/write/delete registry keys
- Copy/delete/modify files in
C:\Program Files\MyApp\MyData
Number 6 can be solved by relocating this folder to My Documents (its location is stored in the registry*), or granting the user "Full control" permissions to C:\Program Files\MyApp\MyData
, or letting Win7 make the necessary modifications in the VirtualStore folder.
Numbers 3 and 4 is more difficult to deal with because Application1 has to read files in C:\Program Files\MyApp
. Application1 will not be using "Run as administrator," and I need to do more research to figure out how the VirtualStore folder can be used to bridge the gap between Application2 and Application1.
As for the other points, I am trying to figure out options:
- Please let me know if/how it is possible to perform these actions under a non-Administrator user account and without "Run as administrator."
- Please let me know if any of the actions are impossible without being an Administrator.
- Feel free to point out any technical mistakes that I may have made in the contents of this question.
- Again, I am trying to avoid dialog boxes during application runtime.
*Thinking out loud here: I would need to delete C:\Program Files\MyApp\MyData
after copying to C:\My Documents\MyData
, and I would need to modify the registry key storing the folder path, maybe these steps could be done during installation.
Discoveries
On Windows 7, even without "Run as administrator" you can:
- Create/delete User Data Sources
- Create/modify/delete files in
C:\Users\Public\Documents
orC:\Users\currentuser\Documents
- Create/delete registry keys in
HKEY_CURRENT_USER
Furthermore, I believe it is dangerous to have a Windows 7 application without a UAC Application Manifest file. Because, if you don't have one, Windows 7 decides for you whether to run the application in Compatibility Mode or not. If you have one, you can specify how your application needs to run.