Vista/7 UAC: how to lower process privileges

Posted by Sergey on Stack Overflow See other posts from Stack Overflow or by Sergey
Published on 2010-03-30T18:42:05Z Indexed on 2010/03/30 18:43 UTC
Read the original article Hit count: 711

Filed under:
|
|
|

Hi all,

Is it possible for a process to lower itself from elevated UAC permission back to standard user? If not can the elevated process launch its copy with standard user token and then kill itself? Any code examples (C# preferred)?

Details:

Problem: - user installs my product (written in C#) - the installer elevates its UAC permission to admin - at the end the installer launches my exe - the exe inherits elevated permissions from admin - the exe mounts network drives which become invisible in Windows Explorer (that runs with regular permissions)

Options I considered: 1) break installer into outer exe and inner exe, that runs with elevated permission. The install consists of 1000+ lines of NSIS code and I don't know anything about NSIS 2) mounting drives with lower permissions. If I do it Win Explorer can see the drives but my exe cannot 3) setting EnableLinkedConnection registry option to 1. This is a no-go because it requires PC reboot during the installation.

Please help!

Sergey

© Stack Overflow or respective owner

Related posts about uac

Related posts about Vista