|
|
#1 |
|
Junior Member
Join Date: Nov 2008
Posts: 5
|
EnvVarUpdate.nsh and WM_WININICHANGE timeout
The following line of code in EnvVarUpdate.nsh hangs up my installer until the timeout is hit:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 If I comment this line out, everything seems to work fine, and there is no delay - I suspect this is for older operating systems. I'm working on a Windows 2003 server (the installer is for server software). I'm using NSIS 2.40. Can this line be safely removed, or is there some fix? I'm calling the function using: ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\lib" Thanks, Geoff. |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
If you remove it, changes will only take effect after reboot.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Nov 2008
Posts: 5
|
Thanks for the quick reply.
The changes seem to take without a reboot on Server 2003 - at least when I go to 'Control Panel - System' and look at the environment variables it's there after running the installer. WM_WININICHANGE seems to have been retired in newer Windows systems: http://msdn.microsoft.com/en-us/library/ms725499.aspx I tried sending a WM_SETTINGCHANGE instead and it didn't hang up, although I'm not sure how to verify if it's working, as the change takes regardless. I'm not sure about my syntax either: SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000 Is there a way in NSIS to tell which operating system is in use, and filter the message appropriately? Thanks, Geoff. |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
The changes will appear in the control panel but if you open up a new command shell and test it you should see it won't take effect until you reboot or use the control panel to apply the change.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Nov 2008
Posts: 5
|
Yes, you're right, the changes don't show up properly when I open a new command shell.
WM_SETTINGCHANGE also doesn't solve the problem after all, in that it still hangs up. It seemed to be working initially, but it's not anymore. I must have made a mistake and not saved the included file. If I reduce the timeout to 250, the wait is much shorter, and the changes take - they show up in a new command prompt window. Do you know what the timeout is waiting for? Thanks, Geoff. |
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
The timeout is waiting for one of the programs in your system which is not responding. It might be busy or it might have some sort of a bug preventing it from responding in time.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Nov 2008
Posts: 5
|
That was it exactly - there was an unresponsive IEXPLORE.EXE running in the background. After rebooting, no problem with the installer hanging up.
Is a /TIMEOUT=0 valid? Basically to say, I don't care if all the programs respond to the change, just send the message and move on? I tried it and it seems to work - a new command prompt window reflects the change. Thanks, Geoff. |
|
|
|
|
|
#8 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
/TIMEOUT=0 is invalid and will act exactly as a normal SendMessage and this means completely synchronous. That means if you get a non responding program, there will be no timeout. If you don't mind for non responding programs, use a very small timeout, but not 0.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Nov 2008
Posts: 5
|
Good to know! Thanks for all your help today, it's been invaluable.
Geoff. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|