This is not exactly a device driver question, but I figure all the
system-level folks here can probably help…
Within a user-mode process, I need to be able to launch another process
as another user. I think I can do that with LogonUser() and
CreateProcessAsUser(), or one of the related calls. The problem is that
for all of those functions, I need to supply the password as clear
text. This means I need to either prompt the user interactively to
enter the password as needed, or I need to obtain the password in
advance, encrypt it, store it on disk, and decrypt it as needed. User
interaction is not acceptable for my current work. And I would like to
avoid dealing with encryption and the security implications of storing
the password myself if at all possible. My process that is trying to
launch the other process is already running as the system account. So
I’m wondering, given my somewhat privileged status, is it possible to
create a process as a different user, particularly a less privileged
user, without specifying the password? I know that on UNIX, you can
always go from root to other users without the password. I’m wondering
if it is possible to do the same thing in Windows.
To give some background, I’m working on an NT4 style printer port
monitor, and it needs to launch an application after every print job for
further processing. The monitor is attached to the spoolsv.exe process,
which the XP task manager says is run as the user “SYSTEM”. The
application needs to be launched as a different user because it needs to
access a particular printer that is only set up for that user. I also
want to make sure HKEY_CURRENT_USER gets set correctly. Plus, I think
it is a bad idea to just launch stuff under the system account.
Thanks in advance for any insights!