-2

Before saying this is another duplicate question, it is not.

So I'm coding an application which needs full admin rights and until here is all good, I can do it without problems by editing the manifest and setting it as requireAdministrator.

Now.. the problem is this: my application starts at startup so every time UAC pops up. I noticed that antivirus softwares for example require admin rights only the first time not always every reboot of system.

So.. is it possible to make the application display the UAC only when opening it first time, not always?

xpirt
  • 30
  • 1
  • 7
  • 3
    It _is_ a duplicate. Try using the search. As for your example: a virus scanner installs itself as lower-level system objects like Windows Services and filesystem filter drivers, and you only need UAC to do that once: during installation. Then the service or driver runs under different privileges or even a different ring. The GUI of your virus scanner simply sends commands to the service, so it doesn't need administrative privileges. – CodeCaster Nov 12 '14 at 19:36
  • 1
    It's not enough to just *say* it's not a duplicate. If you think it's different from other questions, you need to be specific about which question it is similar to, and *why* it is not a duplicate. – Blorgbeard Nov 12 '14 at 19:37
  • @CodeCaster so how can I make my own service and connect it with my application without requireAdministrator. I don't need codes I'd like just some theory. You said it can be coded in low-level languages so c++ should be good to go. – xpirt Nov 12 '14 at 19:49
  • Try the answer for running it as a task. http://superuser.com/questions/119086/windows-7-always-remember-uac-choice-for-an-application – Steve Coleman Nov 12 '14 at 19:53

1 Answers1

1

I think you've missed the point of UAC. A process triggers a UAC prompt when it indicates it needs admin privileges, for example to install an application or modify system files. So if your app doesn't constantly need admin privileges, then don't have it ask for them. Separate the bits out that need admin privileges into separate components.

mason
  • 31,774
  • 10
  • 77
  • 121
  • as it is declared in manifest when the app is launched the UAC popup appears – xpirt Nov 12 '14 at 19:50
  • @xpirt You aren't limited to shipping a single executable. You can multiple executables, each with their own manifests. Common examples of this would be an application that has a self-updater. That self-updater is often a separate executable. – mason Nov 12 '14 at 19:58
  • yes but for ex. my app needs editing a registry key every startup so it has to run elevated. but every time viewing the pop-up is really annoying.. – xpirt Nov 12 '14 at 20:01
  • @xpirt Then either ask the user to disable UAC, or redesign your app so that it has no need to modify the registry key. – mason Nov 12 '14 at 20:02
  • not a professional way to do it :) – xpirt Nov 12 '14 at 20:04
  • @xpirt That is *the way* the programs work, so it's not a question of whether it's professional or not. Another alternative is to create a [service app](http://msdn.microsoft.com/en-us/library/d56de412(v=vs.110).aspx) that performs the modifications and has the necessary privileges. Depending on your needs, your entire app can be the service app, or if you also need a UI then you can have a separate app that communicates with the service app. – mason Nov 12 '14 at 20:06