Func _IniReadSectionEx($sIniFile, $sSection, $iReadMode=-1)
Local $aFileReadArr = StringSplit(StringStripCR(FileRead($sIniFile)), @LF)
If @error Then Return SetError(1, 0, "")
Local $aRetArr[$aFileReadArr[0]+1][2], $iUbound, $iSplitPos, $sKey, $sValue
For $i = 1 To $aFileReadArr[0]
If $aFileReadArr[$i] = "[" & $sSection & "]" Then
For $j = $i+1 To $aFileReadArr[0]
If StringLeft($aFileReadArr[$j], 1) = "[" Then ExitLoop 2
$iSplitPos = StringInStr($aFileReadArr[$j], "=")
If $iSplitPos < 1 Then $iSplitPos = StringLen($aFileReadArr[$j]) + 1
$sKey = StringLeft($aFileReadArr[$j], $iSplitPos-1)
$sValue = StringTrimLeft($aFileReadArr[$j], $iSplitPos)
If $sKey = "" Then ContinueLoop
If $iSplitPos = 0 Then $sValue = ""
Switch $iReadMode
Case 1 ;Do not read comments
If StringRegExp($aFileReadArr[$j], "\A(\s+|);") Then ContinueLoop
Case 2 ;Do not read keys without values but read the comments
If ($sValue = "" Or $sValue = $aFileReadArr[$j]) And _
Not StringRegExp($aFileReadArr[$j], "\A(\s+|);") Then ContinueLoop
Case 3 ;Do not read all except the lines with key=value (as default behaviour of IniReadSection)
If Not StringRegExp($aFileReadArr[$j], "\A.*=.*$") Then ContinueLoop
EndSwitch
$aRetArr[0][0] += 1
$aRetArr[$aRetArr[0][0]][0] = $sKey
$aRetArr[$aRetArr[0][0]][1] = $sValue
Next
ExitLoop
EndIf
Next
ReDim $aRetArr[$aRetArr[0][0]+1][2]
Return $aRetArr
EndFunc