<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=IniGetSectionNames</id>
	<title>IniGetSectionNames - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=IniGetSectionNames"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=IniGetSectionNames&amp;action=history"/>
	<updated>2026-05-12T20:52:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=IniGetSectionNames&amp;diff=23937&amp;oldid=prev</id>
		<title>Anders: Created page with &quot;{{PageAuthor|Anders}}  == Usage / Example == &lt;highlight-nsis&gt; Function MyIniEnumCallback Pop $0 ; Get section name from stack DetailPrint $0 ${If} $0 == &quot;BAZ&quot; 	${IniGetSection...&quot;</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=IniGetSectionNames&amp;diff=23937&amp;oldid=prev"/>
		<updated>2013-08-29T18:58:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{PageAuthor|Anders}}  == Usage / Example == &amp;lt;highlight-nsis&amp;gt; Function MyIniEnumCallback Pop $0 ; Get section name from stack DetailPrint $0 ${If} $0 == &amp;quot;BAZ&amp;quot; 	${IniGetSection...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageAuthor|Anders}}&lt;br /&gt;
&lt;br /&gt;
== Usage / Example ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Function MyIniEnumCallback&lt;br /&gt;
Pop $0 ; Get section name from stack&lt;br /&gt;
DetailPrint $0&lt;br /&gt;
${If} $0 == &amp;quot;BAZ&amp;quot;&lt;br /&gt;
	${IniGetSectionNames_StopEnum}&lt;br /&gt;
${EndIf}&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&lt;br /&gt;
Section&lt;br /&gt;
WriteIniStr $temp\test.ini foo a b&lt;br /&gt;
WriteIniStr $temp\test.ini bar a b&lt;br /&gt;
WriteIniStr $temp\test.ini BAZ a b&lt;br /&gt;
WriteIniStr $temp\test.ini x a b&lt;br /&gt;
WriteIniStr $temp\test.ini y a b&lt;br /&gt;
WriteIniStr $temp\test.ini z a b&lt;br /&gt;
${IniGetSectionNames} &amp;quot;$temp\test.ini&amp;quot; MyIniEnumCallback&lt;br /&gt;
SectionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code / .nsh ==&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!include LogicLib.nsh&lt;br /&gt;
!ifndef NSIS_CHAR_SIZE&lt;br /&gt;
!define NSIS_CHAR_SIZE 1&lt;br /&gt;
!endif&lt;br /&gt;
&lt;br /&gt;
!define IniGetSectionNames &amp;quot;!insertmacro IniGetSectionNames &amp;quot;&lt;br /&gt;
!define IniGetSectionNames_StopEnum &amp;#039;StrCpy $3 &amp;quot;$\n&amp;quot;&amp;#039;&lt;br /&gt;
!define /math _IniGetSectionNames_MAXCCH 0xffff - 1 ; Should be plenty&lt;br /&gt;
&lt;br /&gt;
!macro IniGetSectionNames _INI _FUNCNAME&lt;br /&gt;
!insertmacro _LOGICLIB_TEMP&lt;br /&gt;
GetFunctionAddress $_LOGICLIB_TEMP &amp;quot;${_FUNCNAME}&amp;quot;&lt;br /&gt;
Push &amp;quot;${_INI}&amp;quot;&lt;br /&gt;
Push $_LOGICLIB_TEMP&lt;br /&gt;
Call IniGetSectionNames&lt;br /&gt;
!macroend&lt;br /&gt;
&lt;br /&gt;
Function IniGetSectionNames&lt;br /&gt;
Exch $1 ; enumfunc&lt;br /&gt;
Push $0 ; str&lt;br /&gt;
Push $2 ; mem &amp;amp; tmp&lt;br /&gt;
Push $3 ; len&lt;br /&gt;
Exch 4 ; .ini on top of stack&lt;br /&gt;
System::Call &amp;#039;*(&amp;amp;t${_IniGetSectionNames_MAXCCH})i.r2&amp;#039;&lt;br /&gt;
System::Call &amp;#039;kernel32::GetPrivateProfileSectionNames(ir2r0,i${_IniGetSectionNames_MAXCCH},ts)&amp;#039;&lt;br /&gt;
Push $2&lt;br /&gt;
loop:&lt;br /&gt;
	System::Call &amp;#039;kernel32::lstrlen(t)(i$0)i.r3&amp;#039; ; (t) is here to trigger A/W detection&lt;br /&gt;
	StrCmp $3 0 done&lt;br /&gt;
	System::Call &amp;#039;*$0(&amp;amp;t${NSIS_MAX_STRLEN}.r2)&amp;#039;&lt;br /&gt;
	IntOp $3 $3 + 1&lt;br /&gt;
!if ${NSIS_CHAR_SIZE} &amp;gt; 1&lt;br /&gt;
	IntOp $3 $3 * ${NSIS_CHAR_SIZE}&lt;br /&gt;
!endif&lt;br /&gt;
	IntOp $0 $0 + $3&lt;br /&gt;
	Push $0 ; Save&lt;br /&gt;
	Push $1 ; Save&lt;br /&gt;
	Push $2&lt;br /&gt;
	Call $1&lt;br /&gt;
	Pop $1&lt;br /&gt;
	Pop $0&lt;br /&gt;
	!ifdef IniGetSectionNames_StopEnum&lt;br /&gt;
	${If} $3 == &amp;quot;$\n&amp;quot;&lt;br /&gt;
		System::Call &amp;#039;*$0(&amp;amp;i${NSIS_CHAR_SIZE} 0)&amp;#039;&lt;br /&gt;
	${EndIf}&lt;br /&gt;
	!endif&lt;br /&gt;
	Goto loop&lt;br /&gt;
done:&lt;br /&gt;
Pop $2&lt;br /&gt;
System::Free $2&lt;br /&gt;
Pop $2&lt;br /&gt;
Pop $0&lt;br /&gt;
Pop $1&lt;br /&gt;
Pop $3&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:INI, CSV &amp;amp; Registry Functions]]&lt;/div&gt;</summary>
		<author><name>Anders</name></author>
	</entry>
</feed>