Encapsulates answer file actions required for Windows Setup to install out-of-box device drivers. Namespace: Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)

Usage

Visual Basic
Dim driverPath1 As DriverPath

Syntax

Visual Basic
Public Class DriverPath
		Inherits AnswerFileSettingOverride
C#
public class DriverPath : AnswerFileSettingOverride
C++
public ref class DriverPath : AnswerFileSettingOverride
J#
public class DriverPath extends AnswerFileSettingOverride
JScript
public class DriverPath extends AnswerFileSettingOverride

Example

The following example demonstrates how to add a driver to the answer file.

noteNote:
To run this example, you must change the value of the variable wimPath to match the path that contains the .wim file on your computer. You also must change the value of the variable ansFile to the name of an answer file on your computer.
// DriverPath.cs

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ComponentStudio.ComponentPlatformInterface;

namespace MyDriverNameSpace
{
	public class MyDriverClass
	{
		static void Main()
		{
			MyDriverClass mDC = new MyDriverClass();
			mDC.HowToAddDriverPath();
			Console.WriteLine(
				"The driver is added to the answer file.");
	}

		public void HowToAddDriverPath()
		{
			// Declare the answer file path: 
			string ansFile =
			 @"C:\myWorkingFolder\My Unattend1.xml";

			// Declare the .wim file path:
			string wimPath = @"C:\myWorkingFolder\install.wim";

			DriverPath nvidiaPath;
			AnswerFile unattend;

			// Create a Cpi instance:
			Cpi n = Cpi.Instance;
		
			// Check if the catalog file is created, if not create one:
			WimInfo wInfo = n.OpenWim(wimPath);

			if (!wInfo.Images[0].ValidateCatalog().Succeeded)
			 wInfo.Images[0].CreateCatalog();

			// Open the offline image:
			OfflineImage image = n.OpenOfflineImage(wInfo.Images[0]);

			// Create the answer file:
			unattend = Cpi.Instance.CreateAnswerFile(image);

			// Add a driver action to add nvidia driver:
			DriverPathCollection driverCollection =
				unattend.GetDriverPaths(ConfigurationPass.auditSystem);
			nvidiaPath = driverCollection.Create(
				@"\\server1\share1\drivers\nvidia\GForce4",
				CreateOptions.ReturnExisting);

			// Optional: add credential to access the driver:
			nvidiaPath.DynamicKey = "nvidia1";
			nvidiaPath.Domain = "domain1";
			nvidiaPath.UserName = "user1";
			nvidiaPath.Password = "password1";

			// Save the answer file:
			unattend.SaveAs(ansFile);
	}
}
}
/* Output:
The driver is added to the answer file.
*/

Remarks

Out-of-box device drivers are installed by overriding certain settings of the Microsoft-Windows-PnpCustomizationWinPE and Microsoft-Windows-PnpCustomizationNonWinPE components. If these settings overrides are specified properly in answer file, the appropriate Windows component will perform the actual installation during Windows Setup.

This class encapsulates all the details needed for installing out-of-box device driver components in a specific configuration pass.

When creating settings overrides in an answer file for an out-of-box device driver installation, you must specify the location of the out-of-box device driver (.inf file), the configuration pass to which the setting will be applied, and the user credentials used to access the location if the driver is available on a network share.

You can use Create to create settings overrides in an answer file for out-of-box device driver installation. You can use GetDriverPaths to get the instance of DriverPathCollection from the answer file.


Inheritance Hierarchy

System.Object
   Microsoft.ComponentStudio.Common.ObjectBase
     Microsoft.ComponentStudio.ComponentPlatformInterface.SettingOverride
       Microsoft.ComponentStudio.ComponentPlatformInterface.AnswerFileSettingOverride
        Microsoft.ComponentStudio.ComponentPlatformInterface.DriverPath

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista, and Windows 2000

Target Platforms

See Also