public override string[] GetEntryNames(string section)
{
// Verify the section exists
if (!HasSection(section))
return null;
VerifyAndAdjustSection(ref section);
// Loop until the buffer has grown enough to fit the value
for (int maxSize = 500; true; maxSize *= 2)
{
byte[] bytes = new byte[maxSize];
int size = GetPrivateProfileString(section, 0, "", bytes, maxSize, Name);
if (size < maxSize - 2)
{
// Convert the buffer to a string and split it
string entries = Encoding.ASCII.GetString(bytes, 0, size - (size > 0 ? 1 : 0));
if (entries == "")
return new string[0];
return entries.Split(new char[] { '\0' });
}
}
}