SetupGetInfDriverStoreLocationA function (setupapi.h)

The SetupGetInfDriverStoreLocation function retrieves the fully qualified file name (directory path and file name) of an INF file in the driver store that corresponds to a specified INF file in the system INF file directory or a specified INF file in the driver store.

Syntax

WINSETUPAPI BOOL SetupGetInfDriverStoreLocationA(
  [in]            PCSTR                FileName,
  [in, optional]  PSP_ALTPLATFORM_INFO AlternatePlatformInfo,
  [in, optional]  PCSTR                LocaleName,
  [out]           PSTR                 ReturnBuffer,
  [in]            DWORD                ReturnBufferSize,
  [out, optional] PDWORD               RequiredSize
);

Parameters

[in] FileName

A pointer to a NULL-terminated string that contains the name, and optionally the full directory path, of an INF file in the system INF file directory. Alternatively, this parameter is a pointer to a NULL-terminated string that contains the fully qualified file name (directory path and file name) of an INF file in the driver store.

For more information about how to specify the INF file, see the following Remarks section.

[in, optional] AlternatePlatformInfo

Reserved for system use.

[in, optional] LocaleName

Reserved for system use.

[out] ReturnBuffer

A pointer to a buffer in which the function returns a NULL-terminated string that contains the fully qualified file name of the specified INF file. This parameter can be set to NULL. The maximum supported path size is MAX_PATH. For information about how to determine the required size of the buffer, see the following Remarks section.

[in] ReturnBufferSize

The size, in characters, of the buffer supplied by ReturnBuffer.

[out, optional] RequiredSize

A pointer to a DWORD-typed variable that receives the size, in characters, of the ReturnBuffer buffer. This parameter is optional and can be set to NULL.

Return value

If SetupGetInfDriverStoreLocation succeeds, the function returns TRUE; otherwise, the function returns FALSE. To obtain extended error information, call GetLastError.

If the size, in characters, of the fully qualified file name of the requested INF file, including a null-terminator, is greater than ReturnBufferSize, the function will fail, and a call to GetLastError will return ERROR_INSUFFICIENT_BUFFER.

Remarks

To determine the size of the return buffer that is required to contain the fully qualified file name of the specified INF file in the driver store, call SetupGetInfDriverStoreLocation and set ReturnBuffer to NULL, ReturnBufferSize to zero, and supply RequiredSize. SetupGetInfDriverStoreLocation will return the required buffer size in RequiredSize.

When device installation preinstalls a driver package in the driver store, it creates two copies of the driver package INF file. Device installation installs one copy in the system INF directory and assigns that copy of the INF file a unique published file name of the form OEMnnn.inf. Device installation installs a second copy of the INF file in the driver store and assigns that copy the original INF file name.

SetupGetInfDriverStoreLocation returns the fully qualified file name of the INF file in the driver store that matches the INF file, if any, that is supplied by FileName. Filename must specify the file name, and optionally the directory path, of an INF file in the system INF directory. Alternatively, Filename must specify the fully qualified file name of an INF file in the driver store.

For example, assume that the INF file for a driver package is Myinf.inf, and that for this driver package, device installation installs the INF file OEM1.inf in the system INF directory C:\Windows\inf. Further assume that device installation installs the corresponding INF file copy C:\windows\system32\driverstore\filerepository\myinf_12345678\myinf.inf in the driver store. In this case, the function returns C:\windows\system32\driverstore\filerepository\myinf_12345678\myinf.inf if FileName supplies one of the following strings: OEM1.inf, C:\Windows\inf\OEM1.inf, or C:\windows\system32\driverstore\filerepository\myinf_12345678\myinf.inf.

Class installers and co-installers can use SetupGetInfDriverStoreLocation to access files in a driver package that is preinstalled in the driver store. To determine the path of the driver package in the driver store, the installer does the following:

  1. Call SetupDiGetDriverInfoDetail to retrieve a SP_DRVINFO_DETAIL_DATA structure for a driver. The InfFileName member of this structure contains the fully qualified file name of the driver INF file in the system INF directory.
  2. Call SetupGetInfDriverStoreLocation and supply the fully qualified file name of the driver INF file that was retrieved by calling SetupDiGetDriverInfoDetail. SetupGetInfDriverStoreLocation will return the fully qualified file name of the driver INF file in the driver store. The directory path part of the fully qualified file name of the INF file is the path of the driver package files.
Note  SetupGetInfDriverStoreLocation does not process the contents of the INF file that is specified in FileName. You cannot use this function to perform a content-specific search for an INF file in the driver store.
 
Call the SetupGetInfPublishedName function to retrieve the fully qualified file name of an INF file in the system INF file directory that corresponds to a specified INF file in the system INF file directory or a specified file in the driver store.

Note

The setupapi.h header defines SetupGetInfDriverStoreLocation as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib

See also

SP_ALTPLATFORM_INFO

SP_DRVINFO_DETAIL_DATA

SetupDiGetDriverInfoDetail

SetupGetInfPublishedName