Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: The INF Dirid String Substitution Sometimes Does Not Work for DIRID_SRCPATH


View products that this article applies to.

Symptoms

For some helpful background information about this issue, see the "More Information" section of the article.

In certain scenarios, the %DIRID_SRCPATH% substitution does not return the expected value. Instead of returning the original directory where the .inf file was installed, the original operating system installation directory is returned. This problem occurs when both of the following conditions exist:
  • The directory where the .inf file was installed is in the DevicePath value of the following registry key:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
  • The .inf file was not installed from the %WINDIR%\Inf directory.
These conditions do not typically exist because the DevicePath registry key typically contains only the %WINDIR%\Inf path.

One scenario where this problem has been reported is during an OEM Preinstall Kit (OPK) installation. An OPK installation requires that paths to pre-installed drivers be included in the DevicePath registry value.

↑ Back to the top


Workaround

To work around this problem, only use the value that is generated by string substitution if the .inf file is being installed from the %WINDIR%\Inf directory; otherwise, use the current directory that the driver package is being installed from.

When the .inf file is installed from %WINDIR%\Inf, as is the case with a pre-installed or previously installed driver, the substitution works correctly.

This workaround is demonstrated by the DDK Toaster Installation Package sample file. Search for "[ToastCoInfo]" in the following folder:
DDK_INSTALL_PATH\Src\General\Toaster\Toastpkg\Toastco\Toastco.c

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

A directory ID (DIRID) is a number that identifies a specific directory in an information (.inf) file. Dirids can be used in .inf file entries to represent all or part of the file path, in the form %dirid%. When the .inf file is loaded, the system replaces the %dirid% tag with the file path that is represented by that dirid.

The Windows DDK documentation describes this technique in the topic "Using Dirids." This topic includes a list of common dirids and the directories that they represent. The %dirid% substitution can be used anywhere in the .inf file that a string value is expected, except in the [Strings] section.

DIRID_SRCPATH (1 or 01) represents the original directory that the .inf file was installed from. This directory may be an Internet site, the manufacturer's CD, or a local directory. When the .inf file is first installed, or when it is pre-installed, this directory matches the directory that the .inf file is being loaded from. After the .inf file is installed on the system, it resides in the %WINDIR%\Inf directory. When the .inf file is loaded from the %WINDIR%\Inf directory, DIRID_SRCPATH continues to match the original source directory for the .inf file, instead of the directory that it is currently being loaded from.

One reason hardware vendors use DIRID_SRCPATH string substitution is so that their co-installers can determine the original source path if the .inf file is loaded from the %WINDIR%\Inf directory. This technique is demonstrated by the DDK Toaster Installation Package sample (the Toasted sample is included in Windows XP and later versions of the DDK). The %dirid% expression is used in Toastpkg.inf (located in the DDK_INSTALL_PATH\Src\General\Toaster\Toastpkg\Inf folder) in the following sample code:
[ToastCoInfo]
; This is used by the toaster co-installer to determine where the original media is
; located (so that it can start value-added setup programs).
OriginalInfSourcePath = %1%
This section is read by the co-installer that is included with the Toaster Installation Package sample. Search for "[ToastCoInfo]" in the following folder:
DDK_INSTALL_PATH\Src\General\Toaster\Toastpkg\Toastco\Toastco.c

↑ Back to the top


Keywords: KB829645, kbbug

↑ Back to the top

Article Info
Article ID : 829645
Revision : 6
Created on : 7/22/2004
Published on : 7/22/2004
Exists online : False
Views : 475