Import INI out of order - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

FGump
Posts: 65
Joined: Thu Jan 05, 2006 7:23 pm

Import INI out of order

I use INI files for many applications and recently started importing these into AI rather than just distributing the file itself. It has been easier to make changes to the INI from within AI. However, AI re-orders my INI file entries. Everything is not in the same order as I placed it in the INI. I believe you are sorting the data upon import.

Would it please be possible to either NOT sort the data or make this an option that the user should select? I do not feel the INI file should be re-arranged. Once the application was installed, I needed to assist a user and we went into the INI file, they couldn't follow what I was trying to help them with.

Thank you very much,

Frank
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Frank,

Actually, AI does not reorder the entries from an imported INI file. It just populates the IniFile table with the sections and keys of the imported INI.

http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

As you can see from the above page, there is no column to specify the order in which the entries will be installed. Windows Installer writes the sections and keys in an arbitrary order (respecting just the ownership of an entry to a specific section).

Additionally, the APIs that work with INI files do not make any assumption on the relative ordering of sections or keys within a section.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
FGump
Posts: 65
Joined: Thu Jan 05, 2006 7:23 pm

Thank you

I understand that the order is not of importance when actually reading/writing to the INI from within my application. However, if you import an INI file that has information in a certain order and then let AI create that INI during the installation, it is NOT in the same order.

Again this does not cause any issues, but when supporting the application the INI file that I have (imported) doesn't exactly match the one created by AI.

For example, if I import the following INI file:

[CONFIGURATION]
;HOST_NAME=testims
HOST_NAME=sysint
;HOST_NAME=modoff
;HOST_NAME=prodims
AI_UPDATE=xldesupt
AI_RETRVE=xldesret

[SYSTEM]
Database=Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\Program Files\MyApp\MyApp.mdb
CheckDataOnUpdate=N

[PATHS]
Logs=\\fs01\data\shared\MyApp

The resulting INI file will look quite different. It would just be nice if it could keep the same order.
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Frank,

As I mentioned previously, AI does not reorder the entries from an INI file. Windows Installer performs the actual installation of imported INI files by reading the IniFile table inside your MSI package.

Since this table contains no ordering information, WI will install the entries in an arbitrary order.

In conclusion, the INI reordering issue is actually a Windows Installer limitation - it stores no information on how the entries should be ordered.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”