When I was working with file association in a .NET application I hadn't had found a way to set it without UAC popping up a confirmation dialog.
Today, when I opened uTorrent and looked up for file association, I've found that you can enable (writing to registry) without any confirmation from the UAC.
How is that possible? uTorrent is not running as an admin.
Edit:
Well, I have just discovered with Process Monitor (Sysinternals) that what uTorrent.exe does is to create a few keys (uTorrent and .torrent) but in HKCU (HKEY_CURRENT_USER
), not in HKEY_CLASSES_ROOT
.
Anyways I also have those keys in HKEY_CLASSES_ROOT
... maybe the installer created those. Not sure.
See this article in MSDN about the global registry being virtualized so that the changes are only effective for your user profile.
来源:https://stackoverflow.com/questions/562386/how-to-change-file-association-without-uac-confirmation