I'm developing windows explorer namespace extension. My application is a dynamic library loaded and used by explorer.exe at some time. I need my DLL to create files in C:\\ and sometimes in other locations which need elevation to perform such operations.
How can I perform such elevation and create file at C:\\ for example ?
If your code runs inside another process it is at the mercy of the elevation state of that process. If that process does not run elevated, and explorer does not, then your code in your DLL cannot execute elevated.
Your solution therefore is to create another process to perform the tasks which require elevation. Do that using one of these methods:
requireAdministrator
option for requestedExecutionLevel
in the application manifest. ShellExecuteEx
with the runas
verb.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.