Friday, November 23, 2012

How to run non-elevated process from existing elevated process?


The following set of articles shed light and provide sample source code for the topic.


Sample source code how to use CreateRestrictedToken to drop admin can be found here (http://www.autohotkey.com/board/topic/72812-run-as-standard-limited-user/), but it is not in C/C++.

Basically, you have to use the following call to drop admin rights (Vista+):


result = CreateRestrictedToken (hExistingToken, LUA_TOKEN, 0, NULL, NULL, NULL, NULL, NULL, &hNewToken);

If you have any questions, feel free to leave them as comments - I will provide you with answer.