cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jspelbring
Level 2

AddProfString() not working correctly

I’m in the process of updating an installer that was authored with InstallShield 2009 to InstallShield 2011. It’s a Basic MSI project, and it uses InstallScript custom actions.
One of those actions manipulates a .INI file (sql.ini in this case). I am using WriteProfString() to create the initial entries, then using AddProfString() to add in duplicate keys.

The WriteProfString works fine, but AddProfString deletes any other key/value pairs for the section.

Is this a known bug? Is there a workaround?

Here is a code excerpt showing what I am doing:

-----------------------------------------------

svSvrName=”MYSERVER”;
DestFileName = svDir ^ "Sybase\\ini\\sql.ini";
svRgatesIPA=”10.1.1.1”;
svInistr = "TCP," + svRgatesIPA + ",4350";

WriteProfString (DestFileName, svSvrName, "query", svInistr);
WriteProfString (DestFileName, svSvrName, "master", svInistr);

svInistr1 = "TCP,127.0.0.1,4350";

AddProfString (DestFileName, svSvrName, "query", svInistr1) ;
AddProfString (DestFileName, svSvrName, "master", svInistr1);

-------------------------------------------------

When this runs, I should have a section with four entries:

[MYSERVER]
query=TCP,10.1.1.1,4350
master=TCP,10.1.11,4350
query=TCP,127.0.0.1,4350
master=TCP,127.0.0.1,4350

What I actually get is:
[MYSERVER]
query=TCP,10.1.1.1,4350

I’m doing my development on a Vista machine, and the installation is being done on a Server 2003 box.

Jon Spelbring
CSC Corp.
618-632-9252 x450
j.spelbring@tricorind.com
jspelbring@csc.com
Labels (1)
0 Kudos
(1) Reply
jspelbring
Level 2

The solution was to apply Hotfix A to InstallShield 2011. The AddProfString now works correctly.
0 Kudos