I don't think so. Starting from Vista, and reasonably set up, I think, only in Windows 7, UAC is not to be bypassed. I mean, you can bypass UAC only if the user gives an explicit permission. In particular, the whole UAC check can be disabled for a whole system, and then the system really becomes vulnerable, but if you try to do it automatically, your program cannot bypass the explicit UAC check with the user. It will either throw a permission exception, or, if you write the application "As administrator", the permission will be granted.
(You probably know that being logged on Windows with Administrator privilege is not enough, you have to run each application with elevated privileges. Please see:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/[
^],
http://www.sevenforums.com/tutorials/11841-run-administrator.html[
^].)
The only thing application can initially do, is to request for elevated privileges from the very beginning, thus saving a user from a troublesome ceremony of choosing this "Run as Administrator" option described above. To do this to your application, you can create and embed appropriate
application manifest with required UAC version. This is simple enough and is described here:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[
^].
If your application can do something like registry access every time you use it, or on a regular basis, this is a very reasonable thing to do so. And of course, if you want to use
Process.Start
(which I don't recommend, it's better to use Registry API or anything you can do to avoid starting a child process), your child process will also inherit already elevated privileges. However, it won't bypass any UAC check. It means the request for UAC dialog will be guaranteed to be presented to the user before any APIs requiring elevated access are called. If the user agrees, the application proceeds with elevated privileged, if not, the whole process will be safely terminated. Of course, this is much better than having a security exceptions when your application is already running.
I did not mention such thing as "XP compatibility mode", just don't want to discuss it here. Of course it would make the system vulnerable. I hope this trash will go out of practice with time and will eventually be phased out. For application development, it's too sloppy to keep to the obsolete "don't care about security" practice. At the same time, keeping the application away from security-sensitive actions or otherwise request for proper permissions is way too easy, so ignoring correct safety practices should not be a discussable option.
[EDIT #1]
I just tried to reproduce it on Windows 7. The behavior was correct: it does request my confirmation with UAC dialog. Something is wrong with your OS. Are you sure you did not lower down system security settings?
If you think the wrong part is having Windows 8, I don't know. I'm not going to try out Windows 8, because I don't consider it as a serious OS, by some other, unrelated reasons. If you firmly maintain that it happens to Windows 8 installed by default, without disabling the UAC in system-wide settings, it will be yet another argument against ever using it.
After all, I tried out Vista, but even in nightmare I could not imagine using it in real work. :-)
[EDIT #2]
More detail on the test described above:
Windows 7 has the following options under the applet "Choose to be notified about changes to your computer". It has 4 options:
- "Always notify me when…"
- Default — Notify me only when programs try to make changes to my computer
Don't notify me when I make changes to Windows settings. - [Same as above adding "don't dim my desktop"]
- Never notify me when…
I tried it with #1 and #2 (default). In both cases, UAC dialog requested me. Normally, I personally use option #1 "Always notify…".
Are you sure you are using the same or equivalent level of UAC notification with Windows 8?
—SA