SetupGetSourceInfo

The SetupGetSourceInfo function retrieves the path, tag file, or media description for a source listed in an INF file.

BOOL SetupGetSourceInfo(
  HINF InfHandle,      // handle to the INF file
  UINT SourceId,       // ID of the source media
  UINT InfoDesired,    // information to retrieve
  PTSTR ReturnBuffer,  // optional, receives the info
  DWORD ReturnBufferSize,  // size of the supplied buffer
  LPDWORD RequiredSize // optional, buffer size needed
);
 

Parameters

InfHandle
Handle of an open INF file that contains a SourceDisksNames section. If platform-specific sections exist for the user's system (for example, SourceDisksNames.mips), the platform-specific section will be used.
SourceId
Identifier for a source media. This value is used to search by key in the SourceDisksNames section.
InfoDesired
A value indicating what information is desired. Only one value may be specified per function call, and they cannot be combined. The following types of information can be retrieved from a SourceDisksNames section:
SRCINFO_PATH
The path specified for the source. This is not a full path, but the path relative to the installation root.
SRCINFO_TAGFILE
The tag file that identifies the source media, or if cabinets are used, the name of the cabinet file.
SRCINFO_DESCRIPTION
A description for the media.
ReturnBuffer
This optional parameter points to a caller-supplied buffer to receive the retrieved information. Path returns are guaranteed not to end with \.
ReturnBufferSize
Specifies the size of the buffer pointed to by ReturnBuffer.
RequiredSize
This optional parameter points to a caller-supplied variable that receives the required size for the buffer specified by ReturnBuffer. If ReturnBuffer is specified and the actual size needed 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 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.

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, SetupGetSourceFileLocation, SetupGetSourceFileSize, SetupGetTargetPath