VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsINIFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'---------------------------------------------------------------------------------------
' Module    : clsINIFile
' Date      : 6/23/2004
' Author    : LoRd[nK] (thevirushunter@hotmail.com)
' Purpose   : Class for handling *.INI files
'---------------------------------------------------------------------------------------

Option Explicit

Private Declare Function WritePrivateProfileStringA Lib "Kernel32.dll" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileStringA Lib "Kernel32.dll" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSectionA Lib "Kernel32.dll" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSectionNamesA Lib "Kernel32.dll" (ByVal lpszReturnBuffer As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Public Function GetPrivateProfileSection(ByVal Section As String, ByVal Path As String) As String()
Dim OutBuf As String * 32767
Dim Length As Long

Length = GetPrivateProfileSectionA(Section, OutBuf, 32767, Path)
If Length Then
    Dim Splt() As String
    Dim I As Long
    Splt() = Split(Mid$(OutBuf, 1, Length - 1), Chr(0))
    For I = 0 To UBound(Splt)
        Splt(I) = Mid$(Splt(I), InStr(1, OutBuf, "=", vbTextCompare) + 1)
    Next I
    GetPrivateProfileSection = Splt()
End If
End Function
Public Function GetPrivateProfileString(ByVal Section As String, ByVal Key As String, ByVal Path As String) As String()
Dim OutBuf As String * 32767
Dim Length As Long

Length = GetPrivateProfileStringA(Section, Key, vbNullString, OutBuf, 32767, Path)
If Length Then
    Dim Splt() As String
    Dim I As Long
    Splt() = Split(Mid$(OutBuf, 1, Length - 1), Chr(0))
    For I = 0 To UBound(Splt)
        Splt(I) = Mid$(Splt(I), InStr(1, OutBuf, "=", vbTextCompare) + 1)
    Next I
    GetPrivateProfileString = Splt()
End If
End Function
