Discussion:
rundll32 printui.dll,PrintUIEntry don't work when running as a ser
(too old to reply)
paultje
2007-09-20 06:30:01 UTC
Permalink
I have the following problem:

I want to save and restore my printerdriver preferences within my
program that runs as a services.

I use the "rundll32 printui.dll,PrintUIEntry /Ss" option and that
works fine until my program is running as a services.

I need to by interactive with my desktop, that means that my services
is running with the Local System Account.

If the application is running as a services the functionality
(restore) "rundll32 printui.dll,PrintUIEntry /Sr" is not working
anymore.
Can anybody help ?
Kind regards
Paul
Mark J. McGinty
2007-09-22 21:56:21 UTC
Permalink
Post by paultje
I want to save and restore my printerdriver preferences within my
program that runs as a services.
I use the "rundll32 printui.dll,PrintUIEntry /Ss" option and that
works fine until my program is running as a services.
I need to by interactive with my desktop, that means that my services
is running with the Local System Account.
If the application is running as a services the functionality
(restore) "rundll32 printui.dll,PrintUIEntry /Sr" is not working
anymore.
Right, because those saved settings are user context specific, a service
running in the machine acount will not have access to settings saved under
some other account.

You might want to try impersonating the desired user account from within
your service, using the LogonUser and ImpersonateLoggedOnUser APIs to create
a token, that's passed to CreateProcess (to perform your rundll32 exec.)
That exec would then take place in the context of the impersonated user.

An alternative would be for the service to run under your user account,
though that may be less than desirable.


-Mark
Post by paultje
Can anybody help ?
Kind regards
Paul
Loading...