Old 1st March 2002, 18:27   #1
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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

KiCHiK
Attached Files
File Type: zip path.zip (1.9 KB, 879 views)
kichik is offline   Reply With Quote
Old 2nd March 2002, 00:07   #2
dbareis
Member
 
Join Date: Apr 2001
Posts: 77
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
dbareis is offline   Reply With Quote
Old 2nd March 2002, 11:26   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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?
Attached Files
File Type: zip path.zip (1.8 KB, 1021 views)
kichik is offline   Reply With Quote
Old 2nd March 2002, 23:35   #4
dbareis
Member
 
Join Date: Apr 2001
Posts: 77
Quote:
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
dbareis is offline   Reply With Quote
Old 3rd March 2002, 14:52   #5
superrock
Member
 
superrock's Avatar
 
Join Date: Jan 2002
Location: Graz, Austria
Posts: 50
Post 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
superrock is offline   Reply With Quote
Old 3rd March 2002, 20:44   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Here is the API function called:

DWORD dwReturnValue;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);

KiCHiK
kichik is offline   Reply With Quote
Old 3rd March 2002, 23:08   #7
superrock
Member
 
superrock's Avatar
 
Join Date: Jan 2002
Location: Graz, Austria
Posts: 50
RefreshEnv Api function

Thanks kichik,

Will implement the function in an exe.

Greetings,
Andreas
superrock is offline   Reply With Quote
Old 18th April 2003, 01:08   #8
GGamer
Junior Member
 
Join Date: Apr 2003
Posts: 2
Question

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
GGamer is offline   Reply With Quote
Old 18th April 2003, 01:17   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Use WriteRegExpandStr instead of WriteRegStr and it should keep the variables.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th April 2003, 22:53   #10
GGamer
Junior Member
 
Join Date: Apr 2003
Posts: 2
Thanks, works a treat!

Ross
GGamer is offline   Reply With Quote
Old 3rd December 2003, 18:19   #11
scarletbow
Junior Member
 
Join Date: Dec 2003
Posts: 1
Send a message via AIM to scarletbow
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?
scarletbow is offline   Reply With Quote
Old 14th February 2007, 12:25   #12
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
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)
PHP Code:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE"STR:Environment" /TIMEOUT=5000 
HTH

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 15th February 2007, 19:51   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
If Explorer itself crashes, you probably have some rouge shell extension.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th February 2007, 01:22   #14
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
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.

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 20th February 2007, 20:11   #15
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Fine, then it's not a rouge shell extension.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st February 2007, 19:55   #16
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
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

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 12th July 2007, 11:04   #17
didava
Member
 
Join Date: May 2007
Posts: 98
trojan >> RefreshEnv.exe
Attached Images
File Type: png trojan.png (42.5 KB, 387 views)
didava is offline   Reply With Quote
Old 12th July 2007, 17:27   #18
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
False positive. Anyway, the SendMessage solution is simpler.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump