SetupGetInfFileList

The SetupGetInfFileList function returns a list of INF files located in a caller-specified directory to a call-supplied buffer.

BOOL SetupGetInfFileList(
  PCTSTR DirectoryPath,  // optional, the directory path
  DWORD InfStyle,        // style of the INF file
  PTSTR ReturnBuffer,    // optional, receives the file list
  DWORD ReturnBufferSize,  // size of the supplied buffer
  PDWORD RequiredSize    // optional, buffer size needed
);
 

Parameters

DirectoryPath
An optional parameter that points 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.
InfStyle
Specifies the style of INF file to search for. May be a combination of the following flags.
INF_STYLE_OLDNT
Windows NT 3.x script-based INF files.
INF_STYLE_WIN4
Windows 95- or Windows NT 4.0-style INF files.
ReturnBuffer
If not NULL, points to a caller-supplied buffer in which this function returns the list of all INF files of the desired style(s) that were found in the specified subdirectory. Filenames are null-terminated, with an extra null at the end of the list. The filenames do not include the path.
ReturnBufferSize
Specifies the size of the buffer pointed to by the ReturnBuffer parameter. If ReturnBuffer is not specified, ReturnBufferSize is ignored.
RequiredSize
If not NULL, points to a caller-supplied variable in which this function returns the required size for the buffer pointed to by the ReturnBuffer parameter. 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 Values

If the function succeeds, the return value is a non-zero value.

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

Remarks

For the Unicode version of this function, the buffer sizes ReturnBufferSize, and RequiredSize are specified in number of characters. This number includes the null terminator. For the ANSI version of this function, the sizes are specified in number of bytes.

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 non-zero value. Otherwise, the return value is zero and extended error information can be obtained by calling GetLastError.

Thus, 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.

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.

QuickInfo

  Windows NT: Use version 4.0 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in setupapi.h.
  Import Library: Link with setupapi.lib.

See Also

Overview, Functions, SetupGetInfInformation