Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Driver Kit
Design Guide
INF Files
 Using Dirids

  Switch on low bandwidth view
Windows Driver Kit: Device Installation
Using Dirids

Many of the directories that appear in INF files can be expressed using directory identifiers (dirids), which are numbers that identify specific directories. Applications can use, but cannot reassign the system-defined directories that are associated with dirids whose values are from -1 through 32767. To create dirids with user-defined values from 32768 through 65534, or 65536 and up, use the SetupSetDirectoryId function (described in the Microsoft Windows SDK documentation). Note that for compatibility with 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:

  1. When the syntax for an INF file entry explicitly specifies a dirid value (the INF DestinationDirs section, for example), express that value as a number. Here is an example:

    [DestinationDirs]
    DefaultDestDir = 11  ;  \system32 directory on NT-based systems

  2. When the syntax for an INF file entry specifies a file path, you can use a system-supplied string substitution to represent part or all of this path. This substitution has the following form:

    %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 file name 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.

ValueDestination Directory
01SourceDrive:\pathname (the directory from which the INF file was installed)
10Windows directory
This is equivalent to %windir%.
11System directory
This is equivalent to %windir%\system32 for NT-based systems, and to %windir%\system for Windows 9x/Me.
12Drivers directory
This is equivalent to %windir%\system32\drivers for NT-based platforms, and to %windir%\system\IoSubsys on Windows 9x/Me platforms.
17INF file directory
18Help directory
20Fonts directory
21Viewers directory
23Color directory (ICM) (not used for installing printer drivers)
24Root 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:\".
25Shared directory
30Root 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.)
50System directory for NT-based operating systems

This is equivalent to %windir%\system (NT-based systems only).

51Spool directory (not used for installing printer drivers − see Printer Dirids)
52Spool drivers directory (not used for installing printer drivers)
53User profile directory
54Directory where ntldr.exe and osloader.exe are located (NT-based systems only)
55Print processors directory (not used for installing printer drivers)
-1Absolute path

Dirid values from 16384 through 32767 are reserved for special shell folders. The following table shows dirid values for these folders.

ValueShell Special Folder
16406All Users\Start Menu
16407All Users\Start Menu\Programs
16408All Users\Start Menu\Programs\Startup
16409All Users\Desktop
16415All Users\Favorites
16419All Users\Application Data
16422Program Files
16425%WinDir%\System32 (valid for Microsoft Win32 user-mode applications running under Windows on Windows (WOW64))
16426Program Files (valid for Win32 user-mode applications running under WOW64)
16427Program Files\Common
16428Program Files\Common (valid for Win32 user-mode applications running under WOW64)
16429All Users\Templates
16430All 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 about CSIDL_Xxx values, see the Windows SDK documentation.


Send feedback on this topic
Built on May 20, 2009
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker