2

One of my process written in C# is forked by another process during application startup. This process needs administrator rights as it is accessing drivers, but the parent application (forking process) was launched in user mode.

There were two ways which I could think of: 1. Change the manifest, but the UAC dialog box would be irritating for the users. 2. Like Linux rpm installation, install the application with super user and give full control to the process

Is there any other better way of doing this? Please guide

Thanks

Abhinav
  • 191
  • 1
  • 3
  • 16
  • 2
    For option 2 in the windows world you don't normally have a superuser user. Normally this would be solved using a background windows service you would install once as a elevated user that listens for calls from your un-elevated program that can execute the commands in a elevated state. – Scott Chamberlain Feb 25 '14 at 19:07

1 Answers1

1

Please see Elevating process privilege programatically.

You either need to throw a UAC Elevation prompt (potentially annoying) or run your root forking process as administrator. By declaring it in the ClickOnce or program manifests, you can ensure that simple double-clicks on your executable will automatically prompt to elevate.

If the end user's machine has UAC enabled, at some point some kind of prompt will appear, as there is no legitimate way of elevating a child process from an unprivileged one.

Community
  • 1
  • 1
selkathguy
  • 1,171
  • 7
  • 17