Link to home
Start Free TrialLog in
Avatar of dfillon
dfillon

asked on

GetTempPath in a Windows NT service

Using GetTempPath in a simple executable works fine. But as soon as it's a service, the TMP or the TEMP variable is not found.

The TMP and TEMP variables are systems variables, not user.

How can I read environment variables when my program runs as NT service ?
ASKER CERTIFIED SOLUTION
Avatar of aldyn
aldyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Epsylon
Epsylon

I don't think that a service can access a user specific registry area, but I may be wrong here....
I know they can't write to HKEY_CURRENT_USER, so I will agree with Epsylon on this one till proven wrong ;P

Tim.
if anybody is interested: i've got some code that does the magic of loggin on a user with a different account. quite impressive: if you are logged on as a plain user , you can start off another process from this code i wrote and bang- the spawned process runs under the context of the administrator :-)

althoug i must admit: the problems with the environment remain. i wanted to add code that loads the registry hive for the respective user, but had no time anymore. if anybody would to add this code, i would be very grateful.

</freter>
Avatar of dfillon

ASKER

It's not exactly what I need, but your answer helps me a lot. thanks.