Jump to content
Sign in to follow this  
rudi

envset(), envupdate() not working for variables *ALREADY* defined?

Recommended Posts

rudi

Hi.

Windows XP SP3. Autoit 3.3.0.0.

Using Ultravnc 1.0.2 [1] I have a winvc service running on my home office PC. To encrypt traffic, I use the "MSRC4Plugin_NoReg.dsm" plugin. The WinVNC service is looking at Window's startup for the environment variable "msrc4pluginkey", which points to "C:\programme\ultravnc\RThome.key".

So that key is required to remote control my home office PC from "outside" my LAN.

To remote control *OTHER* PCs *from* my home office PC, I need to specify other key files. To do so, I wrote a Autoit script, the important lines are these:

EnvSet("msrc4pluginkey","C:\programme\ultravnc\PCxyz.key")
EnvUpdate()
ConsoleWrite(EnvGet("msrc4pluginkey") & @CRLF)
ShellExecute("C:\programme\ultravnc\vncviewer")
; run() is giving the same results

That is working fine, IF the environment variable "msrc4pluginkey" is NOT defined for Windows.

(Workspace, Properties, ?extended?, environment variables, windows variables)

In this case everything goes smoothly.

IF that variable was ALREADY defined at Window's startup, then it doesn't work, even when deleting it from the Windows Environment later.

(After a Windows Reboot it's fine)

With regmon I monitored, that VNCVIEWER.EXE does not read up the environment variables directly from the registry. So I'm wondering, what's going wrong here.

Additional info: When startet from a CMD.EXE box, it's the exactly the same behaviour:

- if the variable is *NOT* defined for "Windows", then it's working fine.

- if the variable *IS* defined for "windows", then always that one is taken, and not the value set in the CMD box prior starting VNCVIEWER.EXE.

So it looks like that's a general "feature" of Windows XP?

Any suggestions how to *FORCE* the use of the value specified through Envset() in stead of a (possibly) predifined variable of the same name in the Windows Environment?

BTW: I can work around this issue by renaming the "startup time key file" to "rc4.key", then this is used in case "MSRC4PLUGINKEY" is not defined. But I'd like to understand, what's going wrong here :)

Regards, Rudi.

[1]... yes, that's not the latest version :) but it's installed on tens of PCs I need to admin ...

[edit: Typo]

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×