SetupGetInfInformation function

[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 SetUpGetInfInformation function returns the SP_INF_INFORMATION structure for the specified INF file to a buffer.


BOOL SetupGetInfInformation(
  _In_    LPCVOID             InfSpec,
  _In_    DWORD               SearchControl,
  _Inout_ PSP_INF_INFORMATION ReturnBuffer,
  _In_    DWORD               ReturnBufferSize,
  _Inout_ PDWORD              RequiredSize


InfSpec [in]

Handle or a file name for an INF file, depending on the value of SearchControl.

SearchControl [in]

This parameter can be one of the following constants.


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.


The string specified for InfSpec is a full path. No further processing is performed on InfSpec.


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.


Same as INFINFO_DEFAULT_SEARCH, except the default locations are searched in reverse order.


Search for the INF in each of the directories listed in the DevicePath value entry under the following:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

ReturnBuffer [in, out]

If not NULL, points to a buffer in which this function returns the SP_INF_INFORMATION structure.

You can call the function one time 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. For more information, see the Remarks section of this topic.

ReturnBufferSize [in]

Size of ReturnBuffer, in bytes.

RequiredSize [in, out]

If not NULL, points to a 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 value

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

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

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


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


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]







Unicode and ANSI names

SetupGetInfInformationW (Unicode) and SetupGetInfInformationA (ANSI)

See also