IniHeadr.exe Reads Section Headers from .INI Files
This article was previously published under Q104096 SUMMARY
The Iniheadr.exe sample defines a function called
GetPrivateProfileSections(), which parses a given .INI file and returns a
buffer containing the section headers separated by NULLs and terminated by
a double NULL. SECTION.C contains the function and a necessary helper
function. The sample allows the user to choose an .INI file using the Open
common dialog box. The section headings are then placed in a list box.
The Windows SDK does not define a function to read all of the section headers from a profile (.INI) file. An application must read the entire .INI file and parse it to obtain the section headers. NOTE: Microsoft recommends using Windows's application programming interfaces (APIs) to read .INI files. The method described below is not guaranteed to work on future releases, especially for system .INI files such as WINFILE.INI, WIN.INI, SYSTEM.INI, CONTROL.INI, and so forth. MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center: Iniheadr.exe (http://download.microsoft.com/download/platformsdk/sample40/3.1/w31/en-us/iniheadr.exe) For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591 (http://support.microsoft.com/kb/119591/EN-US/) How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
A profile file (WIN.INI) or a private profile (such as CLOCK.INI) must have the following form:
[section heading]
entry=value
.
.
.
For example, given a profile containing the following section headings
[windows]
.
.
.
[Desktop]
.
.
.
[Extensions]
GetPrivateProfileSections() parses the profile file and places the
following in a buffer:
windows<NULL>Desktop<NULL>Extensions<NULL><NULL>
| Article Translations
|

Back to the top
