Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4
From: JJ (jjjj_at_nospam.com)
Date: 10/27/04
- Next message: manu: "Re: very simple service: error 0xC0000096 = STATUS_PRIVILEGED_INSTRUCTION (ntstatus.h)"
- Previous message: Gary: "Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- In reply to: Gary: "Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Next in thread: gary: "Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Reply: gary: "Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 27 Oct 2004 11:25:05 -0400
>>I have a previous version of the application( say V1 ) installed in a
home called C:\test1 & the later version ( say V2 ) in another home
called C:\test2.<<
I don't understand what you are saying here. What does the directory where
an executable is installed have anything to do with what environment
variables it gets?
When you have an application installed as a service and it is running in the
System account, it inherits its environment at boot time from the Service
Control Manager (SCM), which has only the values of the System Environment
Variables. Additionally, changing the System Environment Variables will not
affect the service, even between stops and restarts of the service because
the SCM has already inherited its environment. Only rebooting the system
will change them.
"Gary" <debugger@newsgroup.nospam> wrote in message
news:QAOfd.31$am3.33@news.oracle.com...
> Hi Experts,
> I have an application that is installed as a service. Say the service
> name is SRVC.
> I have a previous version of the application( say V1 ) installed in a
> home called C:\test1 & the later version ( say V2 ) in another home
> called C:\test2.
> For V1, the value of a variable %home% is defined to be "C:\test1" in
> the registery & for V2 it is defined to be "C:\test2" . Now for version
> V2 ( note that V1 is not running now ), when I am doing
> GetEnvironmentVariable(), to get the value of %home%, I am getting
> "C:\test1" , whereas I should have got "C:\test2".
> In the code, the logic is such that....... try GetEnvironmentVariable
> to get, if anything is defined or else goto the registery to get the
> value. I debugged to find that in the faulty case,
> GetEnvironmentVariable is returning "C:\test1" , though the V2 version
> of the appln is running & I should have got "C:\test2".
> The registery entries are just fine & I am sure that there are no
> silly or minor issues. When I reboot the box ( Win2k Pro, sp4 ) then
> everything is working fine. After the reboot, I noticed that
> GetEnvironmentVariable returns ERROR_ENVVAR_NOT_FOUND & we go to the
> registery to fetch the value. I am suspecting that there might be some
> stale memory issues which is being returned by GetEnvironmentVariable().
> How does GetEnvironmentVariable work in case of a appln that is running
> as a service ? For an appln started from the shell, its understandable
> that the appln will inherit the env vars defined in the shell. Can there
> be issues with GetEnvironmentVariable ???
> This is a very critical issue for us. Any help is greatly appreciated.
>
> Thanks,
> Gary.
- Next message: manu: "Re: very simple service: error 0xC0000096 = STATUS_PRIVILEGED_INSTRUCTION (ntstatus.h)"
- Previous message: Gary: "Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- In reply to: Gary: "Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Next in thread: gary: "Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Reply: gary: "Re: Urgent...... Issues with GetEnvironmentVariable( ) on Win2k PRO SP4"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|