![]() |
#1 |
Junior Member
Join Date: Mar 2011
Posts: 14
|
Ini edit not being observed by installer
I have an installer that edits the ini file of a particular application. The installer basically changes the value of an integer to a non-zero value (the exact number depends on the situation). If the ini line has a value of zero, the exe carries out function A (just using placeholder names) and if the value is not zero it carries out function B.
If I edit the number in the ini with a text editor everything runs fine afterwards. If I let the installer edit the value, then exit the installer and run the exe everything still runs fine. The problem comes in if I have the exe listed as the program to run after installation is complete. If I run the exe using the checkbox at the end of the installer (close installer and run exe), the exe acts as if the ini value is 0, no matter what it really is set to. Is there some ini save function I need to call to get this to behave the correct way? |
![]() |
![]() |
![]() |
#2 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
First of all, verify that the value is correctly set to non-zero, before you click Finish on the finish page.
Second, what OS is this? Admin or user? What directory is the ini file in? |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
Did you use the FlushINI command?
|
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Mar 2011
Posts: 14
|
To be honest, I acquired the main installer source code from a friend who didn't want to work on it anymore. The flush ini function is nowhere to be found in the script. What is its usage and what effects does it have?
My OS is Windows 7, but the same problem has been confirmed on machines as old as Windows XP. The installer runs as an administrator by default. The ini is installed to a user chosen directory that is confirmed to have a prerequisite application. I can open the ini before, during and after installation and confirm that the non-zero value is there, it just seems like it is being ignored. This is the tidbit of code that I think is most relevant. code: |
![]() |
![]() |
![]() |
#5 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Use ReadINIStr/WriteINIStr if possible. I'm not sure this still applies to Windows 7 but on 9x INI files were cached in memory and so you had to use FlushINI to write the buffers to disk.
Stu |
![]() |
![]() |
![]() |
#6 | |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Quote:
There's no such thing as a default admin. If you need admin you have to enforce it (using the userinfo plugin in .onInit for example). |
|
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: May 2010
Posts: 11
|
What code is in the ReplaceLineStr function? this is where the INI actually gets updated from what I see. You push values to the stack and Call ReplaceLineStr, I imagine that the values are Pop'd in this function and the INI updated.
|
![]() |
![]() |
![]() |
#8 |
Junior Member
Join Date: Mar 2011
Posts: 14
|
Well here's the thing, this installer was coded with a very old version of NSIS. My thought is I should rewrite this now to use WriteIniString like my other updated bits of code and include the flushing function. If that doesn't solve the problem I'll have to do more digging.
And sorry about the confusion, it installs components fine with the current user account settings, so I know that isn't the issue. All I meant is that it asks on all systems I've tested to install as an administrator and works fine every time. |
![]() |
![]() |
![]() |
|
Tags |
ini, installer, number |
Thread Tools | Search this Thread |
Display Modes | |
|
|