Execute user-privileged task from elevated application

143 views Asked by At

I have an applicaction which is running with administrative privileges. Privileges are escalated automatically using application manifest.

  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  </requestedPrivileges>

From this app I have to execute some code as a user who started the app, but without elevation. How can I achieve it?

1

There are 1 answers

1
krowe On BEST ANSWER

You can use impersonation to achieve the desired results. In order to impersonate the current user without a password you need to find another process that the user has ran and get the token from that. Explorer is good for that. Here is full sample code.