Understanding numeric ID used in ActiveX installer .INF file

From a sample .INF file of Citrix XenApp Web Plug for IE, you’ll see there are various numeric IDs that are being used say 24, 17, etc., while specifying the path of the location in .INF file.

 

Sample of WfiCat.inf

[DefaultInstall]                                                  
Addreg=SampleClassReg                                                  
CopyFiles=InstallFilesSection,InstallResourceFilesSection,InstallInfSection 
RunPostSetupCommands=PostSetupCmdSection                          

[DefaultUninstall]                                                  
DelReg=SampleClassUnReg                                                  
DelFiles=InstallFilesSection,InstallResourceFilesSection,InstallInfSection,LogFileSection        
DelDirs=RemoveDirSection
[LogFileSection]                                                  
ICO.LOG                                                  
[RemoveDirSection]   
%24%\%PROGRAMF%Citrixicaweb32%RES_DIR%%LANGUAGE%                                              
%24%\%PROGRAMF%Citrixicaweb32%RES_DIR%
%24%\%PROGRAMF%Citrixicaweb32

[PostSetupCmdSection]
%24%%PROGRAMF%Citrixicaweb32wfica32.exe /license            

 

[SampleClassReg]

HKCR,"WinFrameICADefaultIcon",,,"%24%%PROGRAMF%Citrixicaweb32wfica32.exe,1"

HKCR,"TypeLib{238F6F80-B8B4-11CF-8771-00A024541EE3}2.4"     
HKCR,"TypeLib{238F6F80-B8B4-11CF-8771-00A024541EE3}2.4win32",,,"%24%%PROGRAMF%Citrixicaweb32WFICA.OCX"     
HKCR,"TypeLib{238F6F80-B8B4-11CF-8771-00A024541EE3}2.4FLAGS",,,"0"     
HKCR,"TypeLib{238F6F80-B8B4-11CF-8771-00A024541EE3}2.4HELPDIR",,,"%24%%PROGRAMF%Citrixicaweb32"     
HKCR,"TypeLib{238F6F85-B8B4-11CF-8771-00A024541EE3}2.4",,,"Citrix ICA Client"     
HKCR,"TypeLib{238F6F85-B8B4-11CF-8771-00A024541EE3}2.4"     
HKCR,"TypeLib{238F6F85-B8B4-11CF-8771-00A024541EE3}2.4win32",,,"%24%%PROGRAMF%Citrixicaweb32WFICA.OCX"     
HKCR,"TypeLib{238F6F85-B8B4-11CF-8771-00A024541EE3}2.4FLAGS",,,"0"     
HKCR,"TypeLib{238F6F85-B8B4-11CF-8771-00A024541EE3}2.4HELPDIR",,,"%24%%PROGRAMF%Citrixicaweb32"     
HKCR,"MIMEDatabaseContent Typeapplication/x-ica"   

.

..

[DestinationDirs]                                                   
InstallFilesSection=24,%PROGRAMF%Citrixicaweb32                            
InstallResourceFilesSection=24,%PROGRAMF%Citrixicaweb32%RES_DIR%%LANGUAGE%
InstallInfSection=17                                                   
LogFileSection=24,%PROGRAMF%Citrixicaweb32

[Strings]
PROGRAMF="Progra~1"
RES_DIR=Resource
;
; Language-dependent text follows.
;

 

image

 

In the above file, under [DestinationDirs] section, the syntax followed is:

[DestinationDirs]

[DefaultDestDir=dirid[,subdir]] [file-list-section=dirid[,subdir]]…

dirid

Specifies the directory identifier of the target directory for operations on files that are referenced by name, possibly within a named file-list-section of the INF. For lists of commonly used dirids, see Using Dirids.

 

Here are the list of possible DirID values:

Using Dirids

Many of the directories that appear in INF files can be expressed by 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).

Be aware that a dirid with a value of 65535 is considered synonymous with a dirid with a value of -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.

The following example demonstrates this syntax:

Copy

[DestinationDirs]

DefaultDestDir = 11 ; system32 directory on Windows 2000 and later versions

  1. 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 that 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:

Copy

[aic78xx_Service_Inst]

ServiceBinary = %12%aic78xx.sys

When fully expanded, the path shown in the previous example becomes c:windowssystem32driversaic78xx.sys (assuming that Windows was installed in the c:windows directory). Be aware 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.

Copy

[DestinationDirs]

DefaultDestDir = %11% ; Error! – number expected

[aic78xx_Service_Inst]

ServiceBinary = 12aic78xx.sys ; Error! – unknown directory name

In the first example, the syntax for the DefaultDestDir entry requires its value to be a number. However, 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 that contains drivers (see the following table for more information). The error occurs because Windows looks for the specified file in a directory named "12", which probably does not exist on the computer.

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 %SystemRoot%.

11

System directory.

This is equivalent to %SystemRoot%system32 for Windows 2000 and later versions of Windows..

12

Drivers directory.

This is equivalent to %SystemRoot%system32drivers for Windows 2000 and later versions of Windows.

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". (This might or might not be the same directory as the one represented by dirid 24.)

50

System directory

This is equivalent to %SystemRoot%system.

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

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 UsersStart Menu

16407

All UsersStart MenuPrograms

16408

All UsersStart MenuProgramsStartup

16409

All UsersDesktop

16415

All UsersFavorites

16419

All UsersApplication Data

16422

Program Files

16425

%SystemRoot%system32 (valid for Microsoft Win32 user-mode applications that are running under Windows on Windows (WOW64))

16426

Program Files (valid for Win32 user-mode applications that are running under WOW64)

16427

Program FilesCommon

16428

Program FilesCommon (valid for Win32 user-mode applications that are running under WOW64)

16429

All UsersTemplates

16430

All UsersDocuments

In addition to the values in this table that are defined in Setupapi.h, you can use any of the CSIDL_Xxx values that are 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.

 

 

References:

Using Dirids (Windows Drivers)

INF DestinationDirs Section (Windows Drivers)

About INF File Architecture

Packaging ActiveX Controls

Leave a Reply

Your email address will not be published. Required fields are marked *