SetupEnumInfSectionsA function (setupapi.h)
[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]
The SetupEnumInfSections function retrieves section names from an INF file.
Syntax
WINSETUPAPI BOOL SetupEnumInfSectionsA(
[in] HINF InfHandle,
[in] UINT Index,
[out, optional] PSTR Buffer,
[in] UINT Size,
[out, optional] UINT *SizeNeeded
);
Parameters
[in] InfHandle
Handle to the INF file that is to be queried.
[in] Index
The zero-based index of the section name to retrieve. This index may not correspond to the order of sections as they appear in the INF file.
[out, optional] Buffer
Pointer to a buffer that receives the section name. You can call the function once to get the required buffer size, allocate the necessary memory, and then call the function a second time to retrieve the name. Using this technique, you can avoid errors caused by an insufficient buffer size. This parameter is optional. For more information, see the Remarks section.
[in] Size
Size of the buffer pointed to by ReturnBuffer in characters. This number includes the terminating NULL character.
[out, optional] SizeNeeded
Pointer to a location that receives the required size of the buffer pointed to by ReturnBuffer. The size is specified as the number of characters required to store the section name, including the terminating NULL character.
Return value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
GetLastError returns ERROR_NO_MORE_ITEMS if the value of EnumerationIndex is greater than or equal to the number of sections names in the INF file.
Remarks
This function can enumerate all unique section names in the INF file. If a section name appears more than once in an INF file, the function returns the name only once using a single enumeration index. To return all section names in the INF file, call the function beginning with an enumeration index of zero and then make repeated calls to the function while incrementing the index until the function returns FALSE and GetLastError returns ERROR_NO_MORE_ITEMS. Your application should not rely on the section names being returned in any order based on the enumeration index.
Note
The setupapi.h header defines SetupEnumInfSections as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | setupapi.h |
Library | Setupapi.lib |
DLL | Setupapi.dll |
API set | ext-ms-win-setupapi-inf-l1-1-1 (introduced in Windows 10, version 10.0.14393) |