Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

DLL in CA depends on enveronments set


2 replies to this topic

wolfUkr

wolfUkr
  • Members
  • 24 posts

Posted 26 May 2004 - 16:00

Help me please!
I create CA with call function from DLL (DLL installed with product ). But this DLL depends on other library who same as installed with product. I create call after copy all library in drive.
Use environment sets have't effect on my library, but if I setup environment vars before execute installation - all OK.
Help me please make a decision this problem (see topic on forum who describe decision this problem but none of theirs don't help me.
1. set environment variable in system configuration (PATH, don't effect)
2. use custom action after WriteEnvironmentString whit code

function SendMessageToUpdateEnvVar(hMSI)
STRING szIniSection;
NUMBER nResult;
LONG success;
STRING svPath, szKey, szEnv;
begin
//**** indirect change environment set ********************
svPath = "D:\\!!!";
szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nResult = RegDBSetKeyValueEx(szKey, "PATH", REGDB_STRING, svPath, -1);

//** send message to process refresh env. string ********************
szIniSection = "Environment";
nResult = SendMessage(hMSI, WM_SETTINGCHANGE, 0, &szIniSection);
//** OR send message2 to process refresh env. string *****
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, &szIniSection, SMTO_ABORTIFHUNG, 10000, success);
end;

OR

function UpdateEnvVar(hMSI)
STRING svPath;
begin
GetEnvVar("PATH", svPath);
svPath = "D:\\!!!";
SetEnvironmentVariable("PATH", svPath);
end;

3. try use CA before "execute" in "install section"
and after WriteEnvironmentString in "execute section"
//like this
Session.Installer.Environment("PATH") = "D:\\!!!";


and no effect. Help! (of course I can rewrite dll with use dynamic link (loadmodule) but I don't right to change code).



wolfUkr

wolfUkr
  • Members
  • 24 posts

Posted 26 May 2004 - 19:57

I discover strange behavior different custom action.

I have 2 custom action with "in-script execution" deferred execution both. First it's DLL (MSI DLL installed with this package), second - (Exe installed with this package). Both have depends on other library, who I copy in "PF\Common Files\Mysoft" (path to this directory I write in system configuration "environment variables" in section PATH [PATH="..."]).

If I install my soft, and PATH to "PF\CF\My soft" don't writed installation crashed (it's unimpotant I was call DLL or EXE CA).


If I change environment on VBScript (before call DLL or EXE)
Session.Installer.Environment("PATH") = "D:\\!!!"
when Install call DLL - installation crashed, but when
Install call EXE - all right.

Help me setup call DLL.




Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 May 2004 - 11:48

The MSI process doesn't notice environment changes during the installation. Since the DLL is loaded by the MSI process, it sees the old environment value.
The EXE runs in a new process and therefore immediately sees the new environment value.