SetupDiSelectOEMDrv function

The SetupDiSelectOEMDrv function selects a driver for a device information set or a particular device information element that uses an OEM path supplied by the user.


BOOL SetupDiSelectOEMDrv(
  _In_opt_ HWND             hwndParent,
  _In_     HDEVINFO         DeviceInfoSet,
  _Inout_  PSP_DEVINFO_DATA DeviceInfoData


hwndParent [in, optional]

A window handle that will be the parent of any dialogs created during the processing of this function. This parameter can be used to override the hwndParent field in the installation parameters block of the specified device information set or element.

DeviceInfoSet [in]

A handle to the device information set for which to select a driver.

DeviceInfoData [in, out]

A pointer to an SP_DEVINFO_DATA structure that specifies a device information element in DeviceInfoSet. This parameter is optional and can be NULL. If this parameter is specified, SetupDiSelectOEMDrv associates the selected driver with the specified device. If this parameter is NULL, SetupDiSelectOEMDrv associates the selected driver with the global class driver list for DeviceInfoSet.

Return value

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved by a call to GetLastError.


SetupDiSelectOEMDrv is primarily designed to select an OEM driver for a device on a local computer before installing the device on that computer. Although SetupDiSelectOEMDrv will not fail if the device information set is for a remote computer, the result is of limited use because the device information set cannot subsequently be used with DIF_Xxx installation requests or SetupDiXxx functions that do not support operations on a remote computer. In particular, the device information set cannot be used as input with a DIF_INSTALLDEVICE installation request to install a device on a remote computer.

SetupDiSelectOEMDrv prompts the user for the OEM path and then calls the class installer to select a driver from the OEM path.


Target platform



Available in Microsoft Windows 2000 and later versions of Windows.


Setupapi.h (include Setupapi.h)





See also




Send comments about this topic to Microsoft