C# – Elevation without restarting an application

.netc++uacvb.net

Has anyone managed to get administration rights through the UAC without restarting the application or embedding a manifest file?

I'd like to write to some files that only administrators can modify, without relying to another elevated application. Is it possible to impersonate an administrator previously calling with some native API the UAC prompt?

I guess this is not possible and I'll have to use an external tool with elevated rights, but I'm asking just in case.

EDIT: I know there are some other similar questions around, but since they do not cover the topic of impersonation (as fas as I've seen), nor some possible native call to the UAC prompt I decided to give a new thread a go…

Best Solution

As stated in this other question, it is not possible, you have can eleveate COM object or another process, but not the current process.

Request Windows Vista UAC elevation if path is protected?