Я пробовал различные методы, используя GetSectionNamesList() и GetPrivateProfileSectionNames(). Кажется, ни один из них не помогает.
Код: Выделить всё
[DllImport("kernel32")]
static extern int GetPrivateProfileSectionNames(byte[] pszReturnBuffer, int nSize, string lpFileName);
public string[] GetSectionNames(string path)
{
byte[] buffer = new byte[1024];
GetPrivateProfileSectionNames(buffer, buffer.Length, path);
string allSections = System.Text.Encoding.Default.GetString(buffer);
string[] sectionNames = allSections.Split('\0');
return sectionNames;
}