SetupSetDirectoryId

The SetupSetDirectoryId function associates a directory identifier in an INF file with a particular directory.

BOOL SetupSetDirectoryId(
  HINF InfHandle,  // handle to the INF file
  DWORD Id,        // optional, DIRID to assign to Directory
  PCTSTR Directory // optional, directory to map to identifier
);
 

Parameters

InfHandle
Handle for a loaded INF file.
Id
This optional parameter supplies the directory identifier (DIRID) to use for the association. This DIRID must be greater than or equal to DIRID_USER. If an association already exists for this DIRID, it is overwritten. If Id is not specified, the Directory parameter is ignored and the current set of user-defined DIRIDs is deleted.
Directory
This optional parameter supplies the directory path to associate with Id. If Directory is NULL, any directory associated with Id is unassociated. No error results if Id is not currently associated with a directory.

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.

ERROR_NOT_ENOUGH_MEMORY
Indicates that a memory allocation failed.
ERROR_INVALID_PARAMETER
The Id parameter is not greater than or equal to DIRID_USER or Directory is not a valid string.

Remarks

SetupSetDirectoryId can be used prior to queueing file copy operations, to specify a target location that is only known at runtime.

After setting the directory identifier, this function traverses all appended INF files, and, if any of them have unresolved string substitutions, attempts to re-apply string substitution to them based on the new DIRID mapping. Because of this, some INF values may change after calling SetupSetDirectoryId.

DIRID_ABSOLUTE_16BIT is not a valid value for Id. This ensures compatibility with 16-bit setupx.

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