- NSIS Discussion
- Search path functions
Archive: Search path functions
kichik
1st March 2002 18:27 UTC
Search path functions
Hi!
I have written some functions for adding/removing directories from the search path of Windows. They work for NT (without restart) and 9x.
I will be happy to see them in the functions.html file or contrib folder so they can help others but me :D
KiCHiK
dbareis
2nd March 2002 00:07 UTC
Hi,
Some (possibly only older editors) can put EOF characters into the file, in which case the approach you use will fail (as your "SET" would never get executed).
Just a warning,
Dennis
kichik
2nd March 2002 11:26 UTC
Thanks Dennis!
After looking in the code again, I have found out that somehow some old code got into it. I have now attached the newest code from my installer script with (I hope) all of the corrections needed.
Please download this version instead of the earlier one.
About your comment, I don't really understand what you mean. Do these editors put EOF in the middle of the file? If so, how else can I seek for the EOF?
dbareis
2nd March 2002 23:35 UTC
Originally posted by kichik
About your comment, I don't really understand what you mean. Do these editors put EOF in the middle of the file? If so, how else can I seek for the EOF?
In the good old days editors added a special EOF character (stupid but true) to files (the reason for the /A /B switches on a copy command), most (all?) programs (including Windows reading autoexec.bat etc) still stop reading at the EOF character.
From memory the EOF character was decimal 26, if I'm wrong then it was 27.
I don'y know how common this would be but I have seen this myself so I know it does happen (I tried to do exactly what your code does).
Bye,
Dennis
superrock
3rd March 2002 14:52 UTC
RefreshEnv
Hi,
Thanks for posting the path script. It would be helpful for me to get also the source for RefreshEnv or if you could explain what exactly it contains (Api call)
Greetings,
Andreas
:)
kichik
3rd March 2002 20:44 UTC
Here is the API function called:
DWORD dwReturnValue;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
KiCHiK
superrock
3rd March 2002 23:08 UTC
RefreshEnv Api function
Thanks kichik,
Will implement the function in an exe.
Greetings,
Andreas
GGamer
18th April 2003 01:08 UTC
Kichik,
I have looked at your zip file and the archive example on sourgefourge. It is almost exactly what I am looking for. In both cases you change HKLU\Enviorment Path Key (which is for the logedon user). But in my case I want to append the path for all the users, HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ Path key (As far as I know this is the right key). I have modified your code to change this key instead. It does append the path, but it seems to fix the %SystemRoot% to a string instead of a variable, eg (in dos)
Before addation:
path=c:\winnt\system\;c:\winnt\
After addition of c:\foo
path=%SystemRoot%;%SystemRoot%\system;c:\foo
Do you have any suggestions?
Thanks,
Ross
kichik
18th April 2003 01:17 UTC
Use WriteRegExpandStr instead of WriteRegStr and it should keep the variables.
GGamer
18th April 2003 22:53 UTC
Thanks, works a treat!
Ross
scarletbow
3rd December 2003 18:19 UTC
I am using Windows XP and when I uninstall everthing seems to work fine. When I check the path it looks ok, but when I try to type in commands that were accessible in my path I can't. Has anybody had this problem yet?
Brummelchen
14th February 2007 12:25 UTC
Lately i used this function:
http://nsis.sourceforge.net/Path_Manipulation
But i had to set timeout=1000 otherwise my explorer will crash badly
(tried several installations/deinstallations with it)
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
>
HTH
kichik
15th February 2007 19:51 UTC
If Explorer itself crashes, you probably have some rouge shell extension.
Brummelchen
18th February 2007 01:22 UTC
no - my system works fine. and the crash happend when opening START - Programs - <subfolder>, not anywhere else.
It exactly happend when i set timout=5000 and right after the (de-)installation (both concerned).
i can do vice versa many times without reboot...
BTW the system timeout here is set to 5000 instead windows default 20000 (all values in milli seconds).
it was this line which crashes my explorer (explorer + task bar/desktop).
It was added to the script which works well.
kichik
20th February 2007 20:11 UTC
Fine, then it's not a rouge shell extension.
Brummelchen
21st February 2007 19:55 UTC
finally i will see when user is using the installer - but till
now no negative feedback (ok i build it in as an option). thx
didava
12th July 2007 11:04 UTC
trojan >> RefreshEnv.exe
kichik
12th July 2007 17:27 UTC
False positive. Anyway, the SendMessage solution is simpler.