public string[] GetKeyNames(string sectionName)
{
int len;
string[] retval;
if (sectionName == null)
throw new ArgumentNullException("sectionName");
//Allocate a buffer for the returned section names.
IntPtr ptr = Marshal.AllocCoTaskMem(IniFiles.MaxSectionSize);
try
{
//Get the section names into the buffer.
len = NativeMethods.GetPrivateProfileString(sectionName,
null,
null,
ptr,
IniFiles.MaxSectionSize,
m_path);
retval = ConvertNullSeperatedStringToStringArray(ptr, len);
}
finally
{
//Free the buffer
Marshal.FreeCoTaskMem(ptr);
}
return retval;
}