SetupGetInfFileListA 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 SetupGetInfFileList function returns a list of INF files located in a caller-specified directory to a call-supplied buffer.

Syntax

WINSETUPAPI BOOL SetupGetInfFileListA(
  [in]      PCSTR  DirectoryPath,
  [in]      DWORD  InfStyle,
  [in, out] PSTR   ReturnBuffer,
  [in]      DWORD  ReturnBufferSize,
  [in, out] PDWORD RequiredSize
);

Parameters

[in] DirectoryPath

Optional pointer to a null-terminated string containing the path of the directory in which to search. If this value is NULL, the %windir%\inf directory is used.

[in] InfStyle

Type of INF file to search for. May be a combination of the following flags.

INF_STYLE_OLDNT

A legacy INF file format.

INF_STYLE_WIN4

A Windows INF file format.

[in, out] ReturnBuffer

If not NULL, points to a buffer in which this function returns the list of all INF files of the desired styles that were found in the specified subdirectory. File names are null-terminated, with an extra null at the end of the list. The null-terminated string should not exceed the size of the destination buffer. 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 data. Using this technique, you can avoid errors due to an insufficient buffer size. The filenames do not include the path. See the Remarks section.

[in] ReturnBufferSize

Size of the buffer pointed to by the ReturnBuffer parameter, in characters. This includes the null terminator. If ReturnBuffer is not specified, ReturnBufferSize is ignored.

[in, out] RequiredSize

If not NULL, points to a variable in which this function returns the required size for the buffer pointed to by the ReturnBuffer parameter, in characters. This includes the null terminator. If ReturnBuffer is specified and the size needed is larger than ReturnBufferSize, the function fails and a call to GetLastError returns ERROR_INSUFFICIENT_BUFFER.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If this function is called with a ReturnBuffer of NULL and a ReturnBufferSize of zero, the function puts the buffer size needed to hold the specified data into the variable pointed to by RequiredSize. If the function succeeds in this, the return value is a nonzero value. Otherwise, the return value is zero and extended error information can be obtained by calling GetLastError.

If multiple INF file styles are returned by this function, the style of a particular INF file can be determined by calling the SetupGetInfInformation function

Note

The setupapi.h header defines SetupGetInfFileList 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

See also

Functions

Overview

SetupGetInfInformation