SetupGetInflnformation

The SetUpGetInfInformation function returns the SP_INF_INFORMATION structure for the specified INF file to a caller-supplied buffer.

BOOL SetupGetInflnformation(
  LPCVOID InfSpec,     // handle or filename of the INF file
  DWORD SearchControl, // how to search for the INF file
  PSP_INF_INFORMATION Return Buffer,
                       // optional, receives the INF info
  DWORD ReturnBufferSize,  // size of the supplied buffer
  PDWORD RequiredSize  // optional, buffer size needed
);
 

Parameters

InfSpec
A handle or a filename for an INF file, depending on the value of SearchControl.
SearchControl
This parameter can be one of the following constants:
INFINFO_INF_SPEC_IS_HINF
InfSpec is an INF handle. A single INF handle may reference multiple INF files if they have been append-loaded together. If it does, the structure returned by this function contains multiple sets of information.
INFINFO_INF_NAME_IS_ABSOLUTE
The string specified for InfSpec is a full path. No further processing is performed on InfSpec.
INFINFO_DEFAULT_SEARCH
Search the default locations for the INF file specified for InfSpec, which is assumed to be a filename only. The default locations are %windir%\inf, followed by %windir%\system32.
INFINFO_REVERSE_DEFAULT_SEARCH
Same as INFINFO_DEFAULT_SEARCH, except the default locations are searched in reverse order.
INFINFO_INF_PATH_LIST_SEARCH
Search for the INF in each of the directories listed in the DevicePath value entry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
 
ReturnBuffer
If not NULL, ReturnBuffer points to a caller-supplied buffer in which this function returns the SP_INF_INFORMATION structure.
ReturnBufferSize
Size of the ReturnBuffer in bytes.
RequiredSize
If not NULL, points to a caller-supplied variable in which this function returns the required size, in bytes, for the buffer pointed to by ReturnBuffer. 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.

If the INF file could not be located, the function returns FALSE and a subsequent call to GetLastError returns ERROR_FILE_NOT_FOUND.

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

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, SetupQueryInfFileInformation, SetupQueryInfVersionInformation