Is it possible for the executable to ask for Administrator rights? (Windows 7)
c++, winapi, windows-7
Solution
You cannot acquire elevated privileges after the process has started. Your options are:
- Put the part of your application that requires elevated privileges into a separate process and manifest that with `requireAdministrator`.
- Run the part of your application that requires elevated privileges as an out-of-proc COM object.
Problem
I am developing a partition disk program, and for me to read the `\\\\.\\PhysicalDrive0` I need admin rights. I am wondering if it is possible, in the run time, for the program to gain admin rights? Is there any win api for that? I want to do that because I want the program to execute with admin rights only when it is reading/writing the disk. For security reasons, I don't want the program to execute all the time with admin rights, because someone could find a bug (stack or heap overflow for example) in some module and execute arbitrary commands as adm.