PDA

View Full Version : setup creates an empty section name in an inifile



NewsArchive
01-07-2011, 02:36 AM
hi

A setup script has a runtime variable: %LOGMANAGERPASSIVEFTP%

In the script, I read the value from the ini file

Set variable %LOGMANAGERPASSIVEFTP% to FUNCTION:GET INI
Value("PassiveFTP") from "%_SB_INSTALLDIR%\Logman.ini"
The ini section specified in the dialog is : Logmanager

The value is shown in a dialog, so the user can change it. This means,
the setup program reads the correct value from the correct inifile,
section, item.

AT the end of the setup, the variable is restored to the ini file

Put INI Value(Logmanager, PassiveFTP, %LOGMANAGERPASSIVEFTP%) to
"%_SB_INSTALLDIR%\Logman.ini"

When I then check the ini file, a new section is created :

[]
PassiveFTP=1

The section name is empty.

I've change the name for the section to logmanagerx, and then it
works.
I've searched the script for other 'logmanager' strings. It appeared
once as the description of a feature. I changed it, but it has no
influence.

What else can I check ?
I can't change the name of logmanager as there are already many
instances of the program and there are other programs expexting the
logmanager section in the logman.ini file.

Thanks

Hans Vinckier

NewsArchive
01-07-2011, 02:13 PM
Hans,

> What else can I check ?
> I can't change the name of logmanager as there are already many
> instances of the program and there are other programs expexting the
> logmanager section in the logman.ini file.

I assume you have another INI function in place that manipulates the
Logman.ini.

I have attached a demo script. It works as expected and creates the correct
INI file and entries in c:\test.

Hope this helps.

Friedrich

NewsArchive
01-07-2011, 02:13 PM
Thanks Friedrich,

I've tested your script and it works as expected.

I did some more research and found a very strange behaviour which I can't explain (yet).

I do the get from the ini, and after that, immediately the put to the ini with
the value just read.
If the section didn't exist in the ini file, I get :

[]
PassiveFTP = 0

I change the value from 0 TO 1 in the ini file (PassiveFTP = 1)
I run the setup and get :

[]
PassiveFTP = 0

I create in the inifile

[Logmanager]
PassiveFTP = 1
[]
PassiveFTP = 0

I run the setup and get

[Logmanager]
PassiveFTP=1
[]
PassiveFTP=1

The value is read by the get ini, and store with the put ini, but wrong section header.

Even more strange :

After the put to [logmanager] of passiveftp = %LOGMANAGERPASSIVEFTP%
I do a put ini tot [logmanager] of extratest with value 25
I run the setup again and get :

[]
extratest=25

This shows that also another value to that section gives a problem, and the
first one is overwritten.

Even strange is that in the same setup I write other entries to the same ini
file, but with a section name [replicate]
and this gives no problem.
Also other entries written to another ini file in the same setup give no problems.

Only entries written to the section [logmanager] are giving trouble.

I'll start erasing aal kin of settings till I get a small setup with the
problem, or till I find the setup part that's giving me the problem.
I'll post the result.

Thanks for helping

Hans Vinckier

NewsArchive
01-07-2011, 02:16 PM
STill problems

I've stripped the setup to a minimum.
no install files, just install type selection.
getting ini values (if they exist).
allowing to modify the values.
put the values back to an ini file.
Still get the problem,

I've added the sb7 file.

Thanks for helping

Hans Vinckier

NewsArchive
01-07-2011, 02:17 PM
I added your functions to the test project and it seems to work as expected.

See attached INITEST.sb7 project.

Friedrich

NewsArchive
01-07-2011, 02:17 PM
But I get the [] with your test project. Hmmm, will check this. Wait a
minute...

Friedrich

NewsArchive
01-07-2011, 02:18 PM
Wow, interesting. In the "Compiler Variables" Visualizer, you have defined
a [LOGMANAGER] compiler variable and set the value to 0. The compiler
misinterprets the INI section name [LOGMANAGER] as compiler variable in the
INI functions.

Please rename your compiler variable [LOGMANAGER] and you are done.

Two quick notes:

1.) 1_12_0_10 is not a valid Windows version number in [PRODUCTVER] and
1_12_0_10 is not a valid Windows version number in your setup version
resource (General Information Visualizer)!

2.) You are you using a Hybrid (32/64-Bit) installer. Do you install native
64-bit components on 64-bit Windows machines? If this is NOT the case (and
I think you are only installing 32-bit components) then switch back to
Windows 32-bit style. NEVER use a hybrid installer if you do not have to
install native 64-bit components on a x64 machine.

Friedrich

NewsArchive
01-07-2011, 02:18 PM
Thanks Friedrich,

I've made the change and it works nice.
I always overlooked these computer variables. I believed it was something from
the past that was maybe hidden somewhere but I couldn't find what.

I alos made 2 modifications as you suggested. Will read this again in the manual.

Thanks for helping

Hans Vinckier

NewsArchive
01-09-2011, 03:20 AM
Hans,

There's also a section in the "Learning SetupBuilder Part I" help file
called
"64 Bits? 32 Bits?"

Jane