DismAddDriver function

Adds a third party driver (.inf) to an offline Windows image.


  _In_ DismSession Session,
  _In_ PCWSTR      DriverPath,
  _In_ BOOL        ForceUnsigned


Session [in]
A valid DismSession. The DismSession must be associated with an image. You can associate a session with an image by using the DismOpenSession function.

DriverPath [in]
A relative or absolute path to the driver .inf file.

ForceUnsigned [in]
A Boolean value that specifies whether to accept unsigned drivers to an x64-based image. Unsigned drivers will automatically be added to an x86-based image.

Value Description
TRUE Add unsigned drivers to an x64-based image.
FALSE Do not add unsigned drivers to an x64-based image.

Return value

Returns S_OK on success.


In this example, the driver being added is located on the technician computer in the folder C:\drivers\. The driver has the filename usb.inf on the technician computer, but is renamed to "OEM1.inf" or "OEM2.inf" in the target image. The numbering of the OEMx.inf files is dependent on the number of drivers added. The new name, for example OEM1.inf, is returned in the DismDriverPackage structure when you call the DismGetDrivers. You should use the new name, OEM1.inf, to specify the DriverPath when you use the DismGetDriverInfo.

hr = DismAddDriver(Session, L"C:\\Drivers\\usb.inf", FALSE);


Requirement Description
Supported host platforms DISM API can be used on any operating system supported by the Windows Assessment and Deployment Kit (Windows ADK). For more information, see the Windows ADK Technical Reference.
Supported image platforms Windows 7, Windows Server 2008 R2, Windows PE 3.0, Windows 8, Windows Server 2012, Windows Preinstallation Environment (Windows PE) 4.0, Windows 8.1, Windows Server 2012 R2, Windows 10, Windows Server 2016
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header DismAPI.h
Library DismAPI.lib
DLL DismAPI.dll