SetupQueryInfVersionInformation

The SetupQueryInfVersionInformation function returns INF file version information from an SP_INF_INFORMATION structure to a caller-supplied buffer.

BOOL SetupQueryInfVersionInformation(
  PSP_INF_INFORMATION InfInformation,
                       // structure that contains INF info
  UINT InfIndex,       // index of the file to investigate
  PCTSTR Key,          // optional, the key to retrieve
  PTSTR ReturnBuffer,  // optional, receives the version info
  DWORD ReturnBufferSize,  // size of the supplied buffer
  PDWORD RequiredSize  // optional, buffer size needed
);
 

Parameters

InfInformation
Points to an SP_INF_INFORMATION structure previously returned from a call to the SetupGetInfInformation function.
InfIndex
Specifies the index of the constituent INF file to retrieve version information from. This index can be in the range [0, InfInformation.InfCount). Meaning that the values zero through, but not including, InfInformation.InfCount are valid.
Key
An optional parameter that points to a null-terminated string containing the key name whose associated string is to be retrieved. If this parameter is NULL, all resource keys are copied to the supplied buffer. Each string is null-terminated, with an extra null at the end of the list.
ReturnBuffer
If not NULL, ReturnBuffer points to a call-supplied character buffer in which this function returns the INF file style.
ReturnBufferSize
Specifies the size of the buffer pointed to by the ReturnBuffer parameter.
RequiredSize
If not NULL, points to a caller-supplied variable in which this function returns the size required for the buffer pointed to by the ReturnBuffer parameter. If ReturnBuffer is specified and the actual size is larger than the value specified by 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 ReturnRequiredSize 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 SetupQueryInfVersionInformation is called on a Windows NT 3.x INF file, then version information is generated from the Windows NT 3.x INF file in the following manner:

  1. The OptionType key in the Identification section of the Windows NT 3.x INF file is returned as the Class key value.
  2. The FileType key in the Signature section of the Windows NT 3.x INF file becomes the Signature key value.
  3. If the value of the FileType key of the Windows NT 3.x INF file is MICROSOFT_FILE, then the Provider key value is set to "Microsoft".

The following table summarizes how the information is translated before it is passed into the SP_INF_INFORMATION structure.

Windows NT 3.x information mapped to Windows 95 or Windows NT 4.0 data
[Identification]
OptionType = Mouse
[Version]
Class=Mouse
[Signature]
FileType = MICROSOFT_FILE

Signature=MICROSOFT_FILE
(if the FileType is MICROSOFT_FILE)
Provider="Microsoft"

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