Edited ini files not permanent

Got a problem you cannot solve? Try here.
Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Edited ini files not permanent

Postby Dan Fisher » Tue Sep 05, 2006 6:57 am

I'm currently evaluating IA6, and it's looking very positive, but I have a problem I can't seem to get round...

I deliver a few ini files, marked as Permanent and Never Overwrite, and then update/add values to them according to user responses.

My problem is that these files are deleted when uninstalling/upgrading, while other permanent files (which are not altered during installation) remain, as expected.

Does anyone know of a way around this? Would I be better off saving all the recorded values as persistant variables, and using the values to rewrite the files on re-install? Would this approach work for an upgrade, or only for the same version running in maintenance mode?
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Sep 05, 2006 8:34 am

Maybe you can try updating those files directly using Write to Text File (and Read from Text File) commands, and see if your changes persist?

You could also write to the registry with the permanent flag, and when your product is being fully uninstalled, use the Delete Registry command to blow away the keys that were recorded (this way keys will survive upgrades).

Persistent variables survive same version re-runs only.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

heni
Posts: 1
Joined: Tue Oct 17, 2006 4:22 am

Postby heni » Tue Oct 17, 2006 4:45 am

I have a similar problem.
I have marked a ini file to be permanent and never overwrite.
I make changes to the ini file.
All those linies with changes is deleted during uninstall and if is the only linie in a section the section header is deleted to.
The ini file itself is correctly not deleted.

Any way i can make the changes stay during uninstall ?

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Tue Oct 17, 2006 5:40 am

Hi Heni

I got around this one by the following method...

1 - On initial installation, write the targetdir to a permanent registry key.
2 - On upgrading, create a directory (~InstallAware Clipboard Data~
~Call DLL Function~
~{0A79CFEE-C30E-4FE4-AA94-08BF4E831BB6}~
~$WINSYSDIR$\\Kernel32.dll,CreateDirectory,bool,,"pointer to string",$MYTEMPDIR$,"pointer to long",,$~
~mIDEFunc.dll\\mEXEFunc.dll~
3 - Check if the ini file exists at the original targetdir you just read from your registry key.
4 - If it does exist then copy the file to your newly created directory using ~InstallAware Clipboard Data~
~Call DLL Function~
~{420C2388-F3D1-4664-AC66-47E8BEC7AE41}~
~$WINSYSDIR$\\Kernel32.dll,CopyFile,bool,,"pointer to string",$MYTARGETDIR$,"pointer to string",$MYTEMPDIR$\\$MYINIFILENAME$,bool,FALSE,$~
~mIDEFunc.dll\\mEXEFunc.dll~
5 - Then, after uninstallation has taken place, reverse the process to copy the file back to your targetdir. This way it doesn't matter if the value of targetdir has changed in the meantime - you still have your ini file intact, in the right place.

Note that you need to copy the ini file out of the way before the call to Install/Remove MSI Package in the Process (Un)Installation region. I have moved this region down my script (to after the interview region) to help with this, and to allow a rollback during upgrading.

Hope this helps.
Dan


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 34 guests