SetupSetDirectoryIdExW function (setupapi.h)

[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 SetupSetDirectoryIdEx function associates a directory identifier in an INF file with a specific directory.

Syntax

WINSETUPAPI BOOL SetupSetDirectoryIdExW(
  [in] HINF   InfHandle,
  [in] DWORD  Id,
  [in] PCWSTR Directory,
  [in] DWORD  Flags,
       DWORD  Reserved1,
       PVOID  Reserved2
);

Parameters

[in] InfHandle

A handle for a loaded INF file.

[in] Id

A directory identifier (DIRID) to use for an association. This parameter can be NULL. 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 zero, the Directory parameter is ignored, and the current set of user-defined DIRIDs is deleted.

[in] Directory

A pointer to a null-terminated string that specifies the directory path to associate with Id. This parameter can be NULL. If Directory is NULL, any directory associated with Id is unassociated. No error results if Id is not currently associated with a directory.

[in] Flags

This parameter can be set to SETDIRID_NOT_FULL_PATH (1) to indicate that the Directory does not specify a full path.

Reserved1

If the value of this parameter is not zero the function returns ERROR_INVALID_PARAMETER.

Reserved2

If the value of this parameter is not zero the function returns ERROR_INVALID_PARAMETER.

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.

Remarks

SetupSetDirectoryIdEx can be used prior to queuing 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, the function attempts to re-apply string substitution to them based on the new DIRID mapping. Because of this, some INF values may change after calling SetupSetDirectoryIdEx.

DIRID_ABSOLUTE_16BIT is not a valid value for Id, which ensures compatibility with 16-bit setup.

Note

The setupapi.h header defines SetupSetDirectoryIdEx as an alias which 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 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 Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header setupapi.h
Library Setupapi.lib
DLL Setupapi.dll

See also

Functions

Overview