GetIniString only works if there is a leading CR

10 views
Skip to first unread message

Günter Rudigier

unread,
4:09 AM (6 hours ago) 4:09 AM
to innosetup
Hi there
I try to use GetIniString to read some app settings for installation but it does not work as expected.

Here is my ini file:
[Settings]
Platform=Desktop

Here is my code to read:
function GetPlatform(): string;
var temp : String;
begin
  temp := ExpandConstant('{commonappdata}\MBB\Settings\LocalSettings.ini');
  Result := GetIniString('Settings', 'Platform', 'None', temp);
end;

If the ini file does not have a leading CR odr Text, i always get 'None', if there is a line before [Settings] i get 'Desktop'

Is this a bug or a feature?

Thx Regards!
Günter

Martijn Laan

unread,
6:21 AM (4 hours ago) 6:21 AM
to innosetup
Hi,

Windows ini files must use Windows newlines (CRLF). It is likely your ini file does not, and then it is not a valid Windows ini file. That could explain why adding an extra line before [Settings] appears to fix it, because the editor might change the newlines.

Note that GetIniString uses the built-in Windows API, not a custom implementation.

So this is likely neither a bug nor a feature, but an invalid ini file format.

Greetings,
Martijn

Op 23-1-2026 om 10:07 schreef Günter Rudigier:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/279d16e6-c24b-4ef3-bd1f-b161b225f326n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages