I have a C++ application that runs as administrator (it is compiled with a manifest with requestedExecutionLevel set to requireAdministrator.
At some point, once all the tasks requiring administration rights are done, I would like to relinquish those rights and perform the remaining tasks as the user that launched the application.
Windows provides the ImpersonateLoggedOnUser function, but I can't find any way to obtain a token for the user that called the application.
Are there any other ways to do what I have described here?