Page 1 of 1

Set Enviornment doesn't refresh Enviornment

Posted: Wed Aug 31, 2011 7:27 am
by ckaware
I'm coming off of InstallAnywhere where you can issue a "RefreshEnviornment" Action after setting Env. variables.
InstallAware doesn't seem to fully refresh the system environment after setting variables.

Can this be fixed?

Thanks,

Chris

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Aug 31, 2011 7:28 am
by ckaware
I'm using IA12.

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Aug 31, 2011 9:18 am
by giaviv
Chris,

Can you please further elaborate about this - what exactly are you trying to do, and how are you observing the wrong behavior?

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Aug 31, 2011 9:44 am
by ckaware
Essentially, the installer sets a bunch of Environment variables and correctly sets the HKLM\SYSTEM\CURRENTCONTROLSET\SESSION MANAGER\ENVIRONMENT keys; however, when opening a command prompt or running an application after the fact, the environment isn't refreshed/ updated.
Shouldn't InstallAware call:

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

To correctly refresh the System Environment?

Thanks,

Chris

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Aug 31, 2011 3:57 pm
by giaviv
Chris,

You can use the Call DLL Function MSIcode command to achieve this - just pass along the parameters you specific above and that should work!

Re: Set Enviornment doesn't refresh Enviornment

Posted: Thu Sep 01, 2011 5:54 am
by ckaware
I figured it was doable, but was just wondering why there isn't any built in functionality :). If a developer "Sets Env. Var" I'm sure 99.9% of the time they'd want the system env. refreshed.

Also, What DLL would you target here, my assumption is user32.dll

Re: Set Enviornment doesn't refresh Enviornment

Posted: Thu Sep 01, 2011 11:52 am
by giaviv
Yes its indeed user32.dll.

Actually, when you set environment variable in cmd, they dont refresh automatically either..

Re: Set Enviornment doesn't refresh Enviornment

Posted: Tue Sep 13, 2011 6:13 pm
by ckaware
Is there any chance InstallAware will have this call built in in an updated version? Your competition (InstallShield/ InstallAnywhere) both provide "Refresh Environment" calls.

I'm still having problems calling this in user32.dll.

The following post was never answered by another user with a similar issue:

http://www.installaware.com/forum/viewtopic.php?f=2&t=2754

Just curious :).

Chris

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Sep 14, 2011 9:51 am
by giaviv
Chris,

Thank you for your input. We will do out best to support this in the future.

What problem are you having with calling user32.dll?

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Sep 14, 2011 10:15 am
by ckaware
The problem is passing in arguments to the SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue); using the Call DLL function and User32.dll.

Do you know how these would be passed in?

Not matter what I try, it's not working. I've posted a link to someone with similar problems back in 2007...

Chris

Re: Set Enviornment doesn't refresh Enviornment

Posted: Wed Sep 14, 2011 5:29 pm
by giaviv
Hey Chris,

This should. As a workaround, you can create your own dll than calls this function from user32.dll, and invoke this dll using the Call DLL Function command.