Many of the directories that appear in INF files can be expressed using directory identifiers (dirids), which are numbers that identify specific directories. Dirids whose values are from -1 through 32767 are reserved for system use. To create dirids with user-defined values from 32768 through 65534, or 65536 and up, use the SetupSetDirectoryId function (described in the Platform SDK documentation). Note that for compatibility with Microsoft® Windows® 9x/Me, dirid 65535 is considered to be synonymous with dirid -1, although the latter (dirid -1) is preferred.
If you intend to use dirids in your INF file, consider the following two guidelines:
[DestinationDirs] DefaultDestDir = 11 ; \system32 directory on NT-based systems
%dirid%
This form consists of a percent (%) character, followed by the dirid for the directory you want to specify, followed by another percent (%) character. A terminating backslash (\) character separates this expression from a following filename or additional directories in the path.
The following example demonstrates this syntax.
[aic78xx_Service_Inst] ServiceBinary = %12%\aic78xx.sys
When fully expanded, the path shown in the previous example becomes c:\windows\system32\drivers\aic78xx.sys (assuming that Windows was installed in the c:\windows directory). Note that the string substitution, or %dirid% form, can be used anywhere a string is expected, with the exception of the INF Strings section of the INF file.
The two following examples show how string substitution should not be used.
[DestinationDirs] DefaultDestDir = %11% ; Error! - number expected [aic78xx_Service_Inst] ServiceBinary = 12\aic78xx.sys ; Error! - unknown directory name
In the first example, the syntax for the DefaultDestDir entry requires its value to be a number, but the %11% expression expands to a string. In the second example, the INF writer apparently intended to set the value for the ServiceBinary entry to a file in the directory containing drivers (see the following table for more information). The error occurs because Setup looks for the specified file in a directory named "12", which probably does not exist on the machine.
The following table shows several commonly-used dirids, and the directories they represent. The values most commonly specified by device INF files and driver INF files are listed toward the top of the table.
| Value | Destination Directory |
|---|---|
| 01 | SourceDrive:\pathname (the directory from which the INF file was installed) |
| 10 | Windows directory This is equivalent to %windir%. |
| 11 | System directory This is equivalent to %windir%\system32 for NT-based systems, and to %windir%\system for Windows 9x/Me. |
| 12 | Drivers directory This is equivalent to %windir%\system32\drivers for NT-based platforms, and to %windir%\system\IoSubsys on Windows 9x/Me platforms. |
| 17 | INF file directory |
| 18 | Help directory |
| 20 | Fonts directory |
| 21 | Viewers directory |
| 23 | Color directory (ICM) (not used for installing printer drivers) |
| 24 | Root directory of the system disk. This is the root directory of the disk on which Windows files are installed. For example, if dirid 10 is "C:\winnt", then dirid 24 is "C:\". |
| 25 | Shared directory |
| 30 | Root directory of the boot disk, also known as "ARC system partition," for NT-based systems. (This might or might not be the same directory as the one represented by dirid 24.) |
| 50 | System directory for NT-based operating systems
This is equivalent to %windir%\system (NT-based systems only). |
| 51 | Spool directory (not used for installing printer drivers – see Printer Dirids) |
| 52 | Spool drivers directory (not used for installing printer drivers) |
| 53 | User profile directory |
| 54 | Directory where ntldr.exe and osloader.exe are located (NT-based systems only) |
| 55 | Print processors directory (not used for installing printer drivers) |
| -1 | Absolute path |
Dirid values from 16384 through 32767 are reserved for special shell folders. The following table shows dirid values for these folders:
| Value | Shell Special Folder |
|---|---|
| 16406 | All Users\Start Menu |
| 16407 | All Users\Start Menu\Programs |
| 16408 | All Users\Start Menu\Programs\Startup |
| 16409 | All Users\Desktop |
| 16415 | All Users\Favorites |
| 16419 | All Users\Application Data |
| 16422 | Program Files |
| 16427 | Program Files\Common |
| 16429 | All Users\Templates |
| 16430 | All Users\Documents |
Besides the values listed in this table that are defined in setupapi.h, you can use any of the CSIDL_Xxx values defined in shlobj.h. To define a dirid value for a folder not listed in this table, add 16384 (0x4000) to the CSIDL_Xxx value. For more information on CSIDL_Xxx values, see the Platform SDK documentation.