سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top